By browsing through the servlet api and the struts api there are no methods to do this. So, I'm looking for some code that reads the input stream, modifies the headers and then forwards that request stream.
Originally posted by cj jack:
I hope I understood what you are asking. But couldn't you wrap the ServletRequest in the java.servlet.http.HttpServletRequestWrapper object, subclass it and provide your implementation of the getParameter(String str) method.
I tired sub classing the java.servlet.http.HttpServletRequestWrapper object but I do not have access to the parameter map in it, as it is private or friendly. If I had access to it, I could then modify it and set the parameter values, add/modify values. Seems it would be a handy thing to do. Maybe I'd have to modify the source for this. Or, if the parameter map is friendly I could add a file in the java.servlet.http package and rejar.
in the sending servlet/JSP put something like:
then in the destination servlet/JSP do something like:
It's intersting though, because in Jsp with the tag:
<jsp:include page="/jsp/myJsp.jsp" flush="true" >
<jsp aram name="myParamName" value="<%=myVar%>" />
you can add or modify parameters, but you can't do this in servlet code.
Some sort of difference between an include and forwarding a request...
In this situation I would simply add an extra Map to the new "wrapper" class, and override the getParameter method to check my map first:
Does that make sense?