Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Modify request URI

 
Robert Garrido
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm implementing a complex filter, this filter receives request from many clients and for some reason some clients send requests with the URI duplicated like this:

/resource/resource/queryString....

I can't touch the code of the clients, but I need to change the incoming URI to
/resource/queryString

now, in my filter method

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) {
//I process the URI here
chain(requests, response);
}

Since there's no httpResponse.setURI() method, How can I change the incoming request URI?

Thanks!!!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldnt that be a job for a custom HttpServletRequestWrapper that redifines getContextPath()?

And probably some other methods.

Bill
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64971
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not just redirect to the correct URI?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic