tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: RequestDispatcher & HttpServletRequest wrapper issue.
Date Sat, 27 Oct 2001 20:49:59 GMT
In servlet 2.2 (i.e. Tomcat 3.x), you are not allowed to wrap requests and
responses.  However, this is allowed in servlet 2.3 (i.e. Tomcat 4.0) as
long as your wrappers extend the provided wrapper base classes.

Craig


On Sat, 27 Oct 2001, Nicolas Romanetti wrote:

> Date: Sat, 27 Oct 2001 12:31:35 -0700
> From: Nicolas Romanetti <nicolas_romanetti@yahoo.com>
> Reply-To: Tomcat Users Mailing List <tomcat-user@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: RequestDispatcher & HttpServletRequest wrapper issue.
>
>   Hello,
>
> I am developing an internationalized web application.
> I am using tomcat 3.2.2 (but the problem I have encountered
> also concern Iplanet 6.1)
>
> I need to be able to process forms submitted in UTF-8,
> so I POST my data using the multipart/form-data enctype.
>
> My Front Controller servlet can recognize such posting,
> handle it and create a 'FormDataRequest' which is a
> kind of wrapper around the original HttpServletRequest.
> This FormDataRequest also implements the HttpServletRequest interface.
> It simply intercept all methods dealing with parameters, the other methods
> are simply invoking their counterpart on the original HttpServletRequest.
>
> Later on, during the request processing, I need to do 2 things:
> a 'forward' and some 'include.
>
> To do so I need to pass to the RequestDispatcher the HttpServletRequest (i.e. my FormDataRequest),
> for example:
>
> request.getRequestDispatcher(page.getViewName(PARENT)).forward(request, response);
>
> Unfortunately this does not work, because apparently the implementation
> of forward (or include) is doing a cast of the request and expects the
> 'vendor' implementation request, as a result I cannot
> pass my wrapper, which is I remind you a perfectly valid HttpServletRequest.
> So instead I pass the original request, but this is a bit annoying as later on
> in the JSP I can't use any
>
> <%= request.getParameter("paramName") %>
>
> (original request can't handle multipart/form-data posting)
>
> to circumvent this I have created a RequestTag that is going to get the
> parameter value from my wrapper.
>
> So my problem is resolved, it works fine, but I am still wondering:
>  - is there a simpler solution?
>  - can we consider as a bug the fact that 'forward' or 'include' won't accept my wrapper?
>
> Thanks in advance for any feedbacks on the topic!
>
> Nicolas.
>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message