tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Bromley <>
Subject Re: Tomcat filter to overwrite the requestURL of incoming httprequest object
Date Mon, 25 Jul 2005 15:20:08 GMT
You have to wrap the HttpServletRequest with a class that overrides the methods relating to
the URI.  I've attached an abstract class that I wrote to make this a bit easier.

You will have to implement the rewriteURL method to do the necessary String parsing.

Then in your filter doFilter:

chain.doFilter(new WrappedRequest(request), response);

(assuming you've written WrappedRequest - that extends the abstract class I've attached).

Good luck.

PS You're question actually has nothing to do with Tomcat specifically...

Jaynika Barot wrote:
> hi all,
> I want to write a filter which will overwrite the request URL in
> incoming httprequest.
> if incoming request's URI contains *./myservletName/extra1/extra2.*
> I want to reset it to *./myservletName?param1=extra1&param2=extra2 and
> pass this request object to subsequent processing (filter chain).
> Is it possible to do?? If so how?
> thx,
> Jaynika
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message