You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/05/29 19:05:53 UTC

DO NOT REPLY [Bug 20330] New: - sendError does not set HTTP status code

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20330>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20330

sendError does not set HTTP status code

           Summary: sendError does not set HTTP status code
           Product: Tomcat 4
           Version: 4.1.18
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Servlet & JSP API
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: tomcat@esposito.newnetco.com


I am running Tomcat 4.1.18 under JBOSS ... I am connecting to Tomcat directly 
(no mod_jk) ... I have an error page configured in my web.xml as follows:

<error-page>
	<error-code>500</error-code>
	<location>/500.shtml</location>
</error-page>

When I add the following to my servlet:

res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);

the error page is returned, but the HTTP status and Content-type are incorrect. 
I used ethereal to sniff the response and see this:

    HTTP/1.1 200 OK\r\n
    ETag: W/"853-1051564868000"\r\n
    Last-Modified: Mon, 28 Apr 2003 21:21:08 GMT\r\n
    Content-Type: text/plain\r\n
    Content-Length: 853\r\n
    Date: Thu, 29 May 2003 16:45:53 GMT\r\n
    Server: Apache Coyote/1.0\r\n

So why isn't the sendError causing the response status to be 500 and the 
Content-type set to text/html?

The ultimate result of this problem is that my error document renders as plain 
text in Netscape ... IE ignores the Content-type header and renders it as 
HTML ...

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org