server 6.1: setting status 500 in response from a J2EE webapp?

For a number of reasons, we would like some error JSPs for our J2EE webapps to set the HTTP status code to 500 (Server Error), including when we forward() requests to the error pages (not just when they're servicing requests that generated uncaught Exceptions).

I cannot tell how to do that with Web Server 6.1 -- if I simply use setStatus() in the JSP, WS 6.1 will replace the body of the response generated by the JSP with the error page defined for the web server. Experimenting with disabling error-j2ee or using a custom "null" SAF was even worse -- WS 6.1 would send an empty document along with the status 500 response headers.

Strangely, if the webapp throws an exception and has an error-page defined in web.xml, the response from WS 6.1 will include the body from the JSP along with an HTTP status code of 500.

How can we make sure that the web server will send a response code of 500 and the JSP/webapp-generated response (body, headers, etc.) when requests are handled by our error JSPs?

Thanks,

Peter

[1052 byte] By [PeterWatkins] at [2007-11-26 10:18:23]
# 1

hi

my error.jsp page looks like this

<%@ page isErrorPage="true" contentType="text/html" %>

<html><body>"This is a error page"</body></html>

<%

response.setStatus(500);

%>

and this error.jsp when gets executed both during the regular error processing and also when executed with dispatcher.forward, correctly sets the response code to 500.

I have verified this to work both with 6.1 Sp5 and also with 7.0

So, I am not sure what is going wrong with you.

chilideveloper at 2007-7-7 2:14:31 > top of Java-index,Web & Directory Servers,Web Servers...