[undertow-dev] response-code handler bypasses configured error pages

Brad Wood bdw429s at gmail.com
Thu Jul 2 18:23:55 EDT 2020


When I configure an error page similar to this:

servletBuilder.addErrorPage( new ErrorPage( "404.html", 404));

This works great when I hit a path in my browser that doesn't exist.  The
contents of the *404.html* file is served with a response code of *404*.

However, if I also use the predicate language to define something like:

path(/box.json)->response-code(404)

and then I hit *localhost/box.json* in my browser, I get a *404* status
code but with no response body.

   - The docs say the response-code handler ends the exchange, but
   should it still respect the error pages?
   - How can I modify my use of Undertow to respect the error pages
   when using the response-code handler?
   - I've seen in the docs the ability to have a
   *addDefaultResponseListener()* but I'm not sure if it is the correct
   solution for this, nor how I would access the error page configuration
   dynamically as to not need to duplicate my work.

Thanks!

~Brad

*Developer Advocate*
*Ortus Solutions, Corp *

E-mail: brad at coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20200702/70666049/attachment.html 


More information about the undertow-dev mailing list