2010/4/16 Unmesh Joshi <unmeshjo...@gmail.com>:
>>>>You have to create your own subclass of HttpServletRequestWrapper.
>>>Note also, that the Servlet specification says something about
>>>wrapping and unwrapping the requests and responses.
> E.g., SRV.6.2.2, SRV.9.9.1 in the Servlet 2.5 specification.
>
> Servlet specification does not talk about overriding getRequestURI,
> getRequestURL or getServletPath methods. Also nothing about setRequest
> method.
> These methods are used by tomcat container for implementing request
> forwarding and include.
> My question was, why these are available on API for developers?
> Overriding these methods will never work, in case
>

Too lazy to comment on that, sorry.

>>>Note, that there is already one such well-known library,
>>>http://tuckey.org/urlrewrite/
>
> UrlRewriteFilter uses request forwarding and include. It does not (and
> can not) use request wrapping.

http://code.google.com/p/urlrewritefilter/source/browse/trunk/src/java/org/tuckey/web/filters/urlrewrite/UrlRewriteWrappedRequest.java

> Just a note, UrlRewriteFilter can not be used with Struts 2.1, because
> Struts 2.1 uses servlet filters as controllers and we can not get
> request dispatcher for filters.

Filters can be called for forwarded and included requests, if you map
them in certain way (something like <dispatcher>INCLUDE</dispatcher>).
See the Servlet spec for details.  SRV.6.2.5

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to