jQuery in Action, 3rd edition
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Modify request URI" Watch "Modify request URI" New topic

Modify request URI

Robert Garrido
Ranch Hand

Joined: Dec 11, 2008
Posts: 30

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:


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

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?

William Brogden
Author and all-around good cowpoke

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

And probably some other methods.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63349

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
It's not a secret anymore!