1

I've used a Request Dispatcher in a Filter to change the request URI, but the problem with this Request Dispatcher is that it breaks the Filter chain. So, the Filter which is going to be called after this Filter doesn't get called.

If I use send redirect then the Filter will be called but the URL is reflected in the browser.

I then tried the HttpRequestWrapper class to change the URI by overriding the getRequestURI() method and I've written the whole logic to change the URI and return it. This method gets called and the URL is indeed changed.

However, Tomcat always throws an HTTP 404 Error. I've also tried with GlassFish.

I don't know what the problem is. Is overriding the getRequestURI() the right thing to do?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Vijay
  • 1,024
  • 6
  • 18

0 Answers0