tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vladimir Mokrozub <...@itc.tambov.gov.ru>
Subject Re: empty error page when using sendError()
Date Sat, 11 Aug 2012 07:17:57 GMT
>On Fri, 10 Aug 2012 10:50:17 -0400
>Christopher Schultz <chris@christopherschultz.net> wrote:

> > 
> > When I try to send error page directly from ErrorHandler using 
> > HttpServletResponse, it works fine and page is displayed, so it
> > seems the problem is with sendError() method. Is this an expected
> > behaviour or some sort of bug?
> 
> Oh... do you mean there is no content when your ErrorHandler sends the
> response? Are you producing any content? I certainly don't see a place
> where you are producing a response document of any kind. What did you
> expect the client to see on the screen?
> 

Hi, thanks for the reply.

1) I mean if I try to send the response like this:
-----------------------
PrintWriter pw = response.getWriter();
pw.write("<html><body>Error!</body></html>");
pw.close();
-----------------------
it works OK and I see an "Error!" message on the client side.

2) If I use sendError() method instead, I don't see anything - just an
empty page.

3) This happens ONLY if the request was forwarded to ErrorHandler
servlet by Tomcat in case of an error or exception:
-----------------------
<error-page>
	<exception-type>java.lang.Throwable</exception-type>
	<location>/ErrorHandler</location>
</error-page>
<error-page>
	<error-code>404</error-code>
	<location>/ErrorHandler</location>
</error-page>
-----------------------
If, for example, I request ErrorHandler directly by URL, I can see an
error page.

So I wonder why this happens: is it a bug or my misunderstanding of
sendError() method?

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


Mime
View raw message