Inside web.xml I defined <error-page>500..., so 500-status is resolving
to JSP error pages. I get inconsistent behaviour when an Exception
occurs during JSP rendering.
1) JSP syntax error (e.g. broken XML):
===
-> 500 status is set correctly
-> forward to jsp-error page is done correctly and 500 returned to browser
2) JSP runtime error:
===
...
${model.causingNullPointerException}
...
-> 200 status
-> i.e. broken 500-forward to error.jsp
-> I get broken HTML inside browser
Second case is quite dangerous because we didn't see anything inside
logs and 200 status was presented though we had production bug. Just
accidently looking at catalina.log (stdout logging of all exception)
covered this.
I checked source-code (6.0.35):
===
core.StandardHostValue:282:
...
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
connector.Response:1457
...
if (isCommitted())
return;
...
My assumption:
- In 1st case 500 forward + status setting works fine, because JSP
rendering breaks from beginning and no content is flushed to output-buffer
- In 2nd case "some" of jsp is rendered and written to output-buffer and
resetting-status is prohibited (see isCommitted() check)
=> i.e. there is no way forwarding to 500 status when error occurred
during runtime of JSP rendering
I guess this is a bug (want to backup first before creating trace-ticket)?
Do you know a workaround for this? Currently I have workaround to have a
special Filter checking for Exceptions and including 200 status. The bad
thing is that still browser/users get returned 200 OK status, though
error occurred , because resetting status isn't allowed.
Thanks for support.
--
manuel aldana
mail: maldana.g...@gmail.com | man...@aldana-online.de
blog: www.aldana-online.de
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org