Hi,

I am having again trouble with the respone.sendError method. The docs say that an IllegalStateException is thrown if response has already been committed. So this should cause an exception:

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  PrintWriter out = response.getWriter();
  out.println("ERROR");
  out.flush();
  response.sendError(404);
}

The exception is thrown out to the console but the response is still written. If I leave out the flush (which commits the response). The error page comes up.

Is this undefined behavior or some missing code path to transform the ISE to a HTTP 500 error response?

I am on Tomcat 6.0.35

Thanks,

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to