2010/4/14 Unmesh Joshi <unmeshjo...@gmail.com>:
> Hi,
>
> I was going through tomcat source code. (Specifically
> ApplicationDispatcher.java). The way HttpServletRequestWrapper is used
> there, puzzled me. What is the intent of all the methods of
> HttpServletRequestWrapper class in
> servlet api?

As JavaDoc for HttpServletRequestWrapper says:
"Provides a convenient implementation of the HttpServletRequest interface that
can be subclassed by developers"

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.

See also STRICT_SERVLET_COMPLIANCE flag here
http://tomcat.apache.org/tomcat-6.0-doc/config/systemprops.html
and the specification chapter that are mentioned there.

Also, basics:
http://en.wikipedia.org/wiki/Adapter_pattern

> Specifically HttpServletRequestWrapper's setRequest method looks like
> exposed only for container writers. It will never work if develoepers
> use this method in their filter to wrap the request (for something
> like url rewriting). What do you think is the intent of exposing this
> method to public?
>
> I was actually thinking if its possible to write Url rewriter (like
> mod_rewrite) using J2EE API. (request.forward does actually the same
> thing, but its container controlled).
>

Note, that there is already one such well-known library,
http://tuckey.org/urlrewrite/

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