> Earlier in this thread, you mentioned a quote from
> the W3C
> specification for HTTP response codes in the 4xx and
> 5xx ranges:
>
> Except when responding to a HEAD request, the
> server SHOULD include
> an entity containing an explanation of the error
> situation.
> This is where the default error page comes into the
> picture.
>
> If you don't have any error pages configured for your
> app and want to
> bypass the default error page, you could do something
> like this in your
> servlet's service method:
>
> try {
> // some code here
> } catch (Throwable t) {
> response.setStatus(500);
> response.flushBuffer();
> // rethrow
> throw new ServletException(t);
> }
> ld that work for you?
I am not writing a servlet -- I am writing a JAX-RS service so that does not work for me.
However, if GlassFish is following the W3C and servlet specifications to the letter, then I should be including an entity body whenever returning an error status. When I return an entity body, GlassFish lets it through. I think this morning I tested with error pages configured in web.xml, and GlassFish allowed my response to be sent as-is to the client even though an error page was defined for that error number. That is what I want to happen. I suspect removing my entity body would have caused GlassFish to display the appropriate error webpage.
Thanks,
Ryan
[Message sent by forum member 'rdelaplante' (ryan_at_ijws.com)]
http://forums.java.net/jive/thread.jspa?messageID=380759