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=9856>.
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=9856

sendError(404) fails after getOutputStream() is called, if you have a custom 404 
error-page

           Summary: sendError(404) fails after getOutputStream() is called,
                    if you have a custom 404 error-page
           Product: Tomcat 4
           Version: 4.0.2 Final
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


A response.sendError(404) invokation will not work correctly if it is done 
after a response.getOutputStream() invokation AND you have a custom 404 error-
page.

The following code works correctly. If you have configured a custom 404 error-
page, you receive it; if you have not configured a custom error page, you will 
receive a default 404 error page.

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
  response.sendError(404);
}

The following code does not work correctly, but I think it should. If you have 
configured a custom 404 error-page, you will receive nothing (each browser will 
handle this differntly); however, if you have not configured a custom error 
page, you will receive a default 404 error page.

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
  response.getOutputStream();
  response.sendError(404);
}

I am using Tomcat 4.0.2 final with Sun's JDK 1.4 final on Linux 7.1 on a single 
Intel processor with 512 MB of memory. I am quite sure that my custom 404 error-
page is configured correctly because it is displayed when the DefaultServlet 
can not find a page and when any Servlet calls sendError(404) without calling 
getOutputStream().

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to