If you create the HttpServletRequestWrapper in a filter - then all should work fine.

If you create a HttpServletRequestWrapper in a servlet (which is what a jsp is too), then use that HttpServletRequestWrapper in a forward - you will get different behaviors on different engines. The spec contradicts itself with respect to the scenario. ( So don't do it. )

If you hunt in the tomcat-dev archives or in bugzilla, there are threads/bugs about this issue.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9754

-Tim

Danny Yoo wrote:
Hi everyone,


I'm running into some behavior that appears to be a bug in Tomcat 4.1.



I've written a small WAR to demonstrate the problem:


http://tesuque.stanford.edu/~dyoo/tomcat_wrapper_bug.war

The source code to this package is:

http://tesuque.stanford.edu/~dyoo/tomcat_wrapper_bug.tar.gz


The situation is the following:


    Given a regular HttpServletRequest object, I wrap my own
    HttpServletRequestWrapper around it.  This wrapper includes a
    setParameter() method that lets me define my own parameters.

    Once I've reassigned a few parameters (like "name"), I do an
    RequestDispatcher.include() to my presentation JSP.

    Within that presentation jsp, I do another include to a small JSP
    page.  I also do some overriding some parameters using jsp:param.

The bug is that the jsp:param tags don't appear to be taking any effect in
my small jsp page!


I've determined that the HttpServletRequest that is being passed to the small jsp page is my own wrapped request object, so there's no way the jsp:param-ed variables can be passed on.


In a normal situation, the code that handles jsp:include will construct its own wrapped request object to pass off any jsp:param'ed parameters. However, for some reason, Tomcat appears not to do this wrapping process on an HttpServletRequest that is already wrapped with HttpServletRequestWrapper. I've looked at the Tomcat source code, and I do see some potential problems in the request wrapping code.


Can someone verify that this is a real bug in Tomcat 4? I'd like to make sure before I make a fool of myself. *grin*




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to