[EMAIL PROTECTED] wrote:
> Hi,
>
> I'm working on few bugs related with RequestDispatcher ( well, it started
> with parameter handling, but RequestDispatcher is the place that have to
> be resolved first in order to resolve parameters - since it is doing
> special things with the params ).
>
> The main issue is what should happen if an exception is thrown in
> include() ?
>
> The current behavior is that the error handler is called, and it displays
> the "500 whatever" or the error page for that exception.
>
> But by reading the spec, it seems that the "correct" thing to do is to
> just throw the exception -
> include() does have a throw declaration and is documented to throw
> exceptions.
>
> My understanding is that "error handlers" ( as declared in server.xml or
> the implicit ones ) should be called only on the top-level request.
> ( a servlet including another one may be able to deal with the errors - if
> it doesn't catch them they will be thrown anyway )..
>
> The particular test is /test/servlet/dispatch.PrintWriterTest1Servlet
> where it expects the error in include to be reported instead of thrown.
>
> My preference would be to fix the test and throw exceptions from
> include(). On the other side this changes the behavior of tomcat - and I
> need a second opinion. If indeed the include() is supposed to throw the
> exception, then it's a spec issue and the previous behavior doesn't
> matter.
>
In Tomcat 4, the following rules are applied:
* If the included servlet throws ServletException or IOException,
propogate it on to the calling servlet (i.e. no error page behavior).
* If the included servlet throws any other exception (such as
NullPointerException), wrap it in a ServletException and propogate
that to the calling servlet (i.e. no error page behavior).
In other words, I understood the spec the same way you did. Error pages only
happen at the top-level servlet.
>
> --
> Costin
>
Craig
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]