Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes Modify request URI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Modify request URI" Watch "Modify request URI" New topic
Author

Modify request URI

Robert Garrido
Ranch Hand

Joined: Dec 11, 2008
Posts: 30
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

Joined: Mar 22, 2000
Posts: 12761
    
    5
Wouldnt that be a job for a custom HttpServletRequestWrapper that redifines getContextPath()?

And probably some other methods.

Bill
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Why not just redirect to the correct URI?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Modify request URI
 
Similar Threads
Problems about Filters in Servlets
Filters and Servlets
Filter chaining
Help - Problems with redirect in servlet filter in my JSF web app
Question 65 Final mock exam - HFSJ