----- Original Message -----
From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "Jon Belinfante" <[EMAIL PROTECTED]>
Sent: Saturday, July 07, 2001 4:44 AM
Subject: Re: Help :: Problem testing Servlet methods that forward to JSPs


>
>
> On Tue, 3 Jul 2001, Jari Worsley wrote:
>
> > Vincent Massol wrote:
> > > Ok, here is the story ... :)
> > >
> > > 1/ If you look at the Tomcat implementation (for Tomcat 3.x and before
> > > only - It is fixed for later version as they had to fix this to
support
> > > Servlet 2.3 Filters), you'll see that the forward() and include()
methods do
> > > a cast of the request object to their own internal object. As the
Request
> > > wrapper does not implement this internal object, it fails.
> >
> > fyi: I am using Resin 1.2.3 and get the same problem, so it looks like
> > Resin suffers from the same problem as Tomcat 3.x
> >
>
> Just for the record, in Servlet 2.2 containers it is *not* legal at all to
> wrap the request and response objects passed to a RequestDispatcher.
> That is why many container implementations of the 2.2 spec use a cast back
> to their own internal implementation objects -- they are relying on this
> prohibition.
>

You are of course completely right Craig and I apologize for putting some
doubt on Tomcat's implementation which was not my intention (but rereading
my post someone could have interpreted it as a somehow bad implementation of
the container, which it is absolutely not).

> In the 2.3 spec, this requirement was relaxed -- but the wrapped request
> and/or response objects you provide *must* implement the provided
> ServletRequestWrapper or ServletResponseWrapper interfaces.  This
> requirement exists so that the container can always follow the chain of
> wrappers back to the original request or response implementation object if
> it needs to.
>

Thanks for that piece of information, I did not know that. That will help
for future Cactus implementation although what I have done so far was to
wrap the Request Dispatcher in order to pass the real request to the
forward() and include() methods. This implementation can be simplified for
Servlet API 2.3 by using the API-defined ServletRequestWrapper.

> Craig McClanahan
Vincent

Reply via email to