Custom request wrapper and then later.. the jsp:param tag
806984Oct 21 2010 — edited Nov 3 2010Hi folks,
First: Not sure if this question should be asked under servlets or JSP as it kinda touches off both... hope it's ok here
I have a webapp that I want to put a filter in front of to manipulate the received parameters before they arrive into the application. My reasons for doing this include a piece of third party software which I don't have permission to mess with, so this approach (using the filter to doctor the inbound parameters) is what I have to go with for now.
OK - so I implemented a filter. And then a custom requestWrapper which extended javax.servlet.http.HttpServletRequestWrapper. I overrode getParameter(), getParameterMap(), getParameterNames() and getParameterValues(). And all went well. I was happy, my debugs showed the appropriate content and off I went to plug the new filter into my application to test it.
Then I hit a little stumbling block. A good number of the JSP's in this application use the jsp:include directive, and then the jsp:param tag to pass information to the included jsp's. Normally, when reading these jsp:param values in an included jsp, one uses request.getParameter(). But of course request.getParameter() is now the method from my custom requestWrapper. It knows nothing about how the jsp:Param tag is magically inserting new parameters into the request.
So can anyone tell me... how does that happen? How do I change my wrapper to cater for parameters created by a JSP using the jsp:param tag?
I'm aware of one option at the moment - that's to revisit all of these pages and remove the use of jsp:param and replace it with setAttribute()... but I'd hate to have to do that! I haven't seen any documentation on how the jsp:param tag actually works, and therefore how I would be able to override whatever it's doing...