tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Bromley <martin.brom...@sustainable-energy.co.uk>
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.
Martin

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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

Mime
View raw message