Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

duplicated request parameters with RequestDispatcher

 
Tapio Niemela
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey im facing really mysterious behaviour with following code. It seems that using RequestDispatcher I got request parameters duplicated
at the receiving end. What I'm trying to with this jsp is actually Intercepting Filter. But in this case I can't use HttpFilter implementation. Don't ask why
This filter should iterate through request parameters and find parameters called xxx. That xxx parameter usually has some specific value, but
on some cases it has also additional information (parameter has two piece of information separated by | character) which should be removed.
Rest of the parameters should be dispatched as they are. Except nextPage, which determines page which is called without the filter.

So calling url before..
myPage.jsp?param=test&xxx=ok&xxx=extrainfo|false&otherParam=foo
turns into this
myFilter.jsp?nextPage=myPage.jsp¶m=test&xxx=ok&xxx=extrainfo|false&otherParam=foo

I tested this with simple receiving end (jsp) which just iterates (with Enumeration) through request parameters and prints them out. For some mysterious
reason it had duplicated the parameters, although request.getQueryString() returned correct result. Do you have any idea what's happening?
Any help greatly appreciated! myFilter.jsp attached..

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My first assumption would be that since you're forwarding the request it's including the parameters of the original request, and the URL you're constructing adds the original request parameters again.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no need to duplicate the parameters on a forward. A forward transitions the same request to the next resource.
 
Tapio Niemela
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your help. So, I'm out of luck, I can't remove the original (false) xxx parameters or nextPage. Without maybe HttpServletRequestWrapper..but thanks anyway
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!