tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Problem with RequestDispatcher
Date Tue, 22 Feb 2000 10:08:49 GMT
> Turns out the RequestDispatcher.include() method uses the following line:
> Request realRequest = ((HttpServletRequestFacade)request).getRealRequest();

It seems the spec requires to pass the _original_ request/response object.

I would love to remove this limitation, I also think it's very usefull to
pass arbitrary request objects to RD - but I don't think we can do too
much about this in Servlet 2.2. 

I know few other engines that assume the parameter of RD is the original 
request, so your servlet will not be portable even if we change tomcat.

The reason for this restriction _may_ be the fact that the engine must
change the Request object, and that's not possible unless with the read
only HttpServletRequest. One solution would be to create a facade, but
that's very expensive - too many object allocation/request. 


> Of course, I was passing *my* PortalRequestFacade object and I get a class
> cast exception. Is it necessary to assume this type of cast? Wouldn't it be
> better to have two include() methods, such as:
>     public void include(ServletRequest request, ServletResponse response);
>     public void include(HttpServletRequestFacade request,
> HttpServletRequestFacade response) {
>       Request realRequest = request.getRealRequest();
> 	Response realResponse = response.getRealResponse();
> 	include (realRequest, realResponse);
> }
> I would extend your facade class to facilitate my needs, however I would
> like this to be a portable solution.
> thanks,
> jim
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message