Showing error pages for tomcat means
1) set the current http status header to an error one (5xx,4xx,etc
depending on error type)
2) send in body of response a html showing error
This can *only* be done if no content has already been send to client
(because of http specification).

Th be sure your exeception get to the user page, you must ensure nothing
is send to client before response is fully generated. The only way i
know to do this is to cache locally the response until servlet return
from processing. And only hat this moment send this cached response to
the client socket. To do this, you have to implement a servlet filter
that provide a wrapper Response to the filter chain and have this
wrapped response implement the response stream as a
ByteArrayOutputStream of something alike. When the chain returns without
exception, you then have to copy that memory stream to original Response
Stream. The draw back is that, if you have lots of simultaneous request
that send response of a few hundred K in size, this takes lots of memory.

an other solution is to use the <%@ page buffer=sizekb %> which will
cache a small amount of response before sending anything to socket, a
good value for buffer size can reduce the odds of having no error
response in cas of errors. (This will anyway fail if any tag call
flush() on response stream)

kempo bob a écrit :
> I have a JSP that uses several tags implemented as tag files (not classic
> custom tag handlers). I want all exceptions to bubble up and be displayed on
> the standard apache error page, but some exceptions are being swallowed
> silently, depending on where they occur relative to the tag being invoked.
>
> example where I get the error page:
>
> <%
>    throw new FooException();
> %>
> <mytags: tag1 attr1="foo" />
>
> example where the exception just goes to the localhost log:
>
> <mytags: tag1 attr1="foo" />
> <%
>    throw new FooException();
> %>
>
> I looked at the generated source for the JSP, and it looks like
> PageContext.handlePageException() might be the culprit. What can I do to
> make all exceptions percolate to the top without being swallowed?
>
> Thanks,
>
> Bobby
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to