This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Servlets and the fly likes Question about HttpRequestWrapper and HttpResponseWrapper Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Question about HttpRequestWrapper and HttpResponseWrapper" Watch "Question about HttpRequestWrapper and HttpResponseWrapper" New topic

Question about HttpRequestWrapper and HttpResponseWrapper

Benny Tang

Joined: Aug 03, 2003
Posts: 26
Hi All,
I want to ask what is the use of the class javax.servlet.http.HttpServletRequestWrapper and javax.servlet.http.HttpServletResponseWrapper? As I seldom use these classes. Can anyone tell me their usage ?

Joined: Dec 02, 2003
Posts: 2
I think they are both implementing exact things as request/response do, the advantage is that they are applying wrapper design pattern. As of the advantage of wrapper, you can check j2ee design pattern.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12893
People use these to implement special handling of things you can't normally get at. For example, one person wanted to substitute values in response headers. See also the javax.servlet.Filter and related interfaces.
I agree. Here's the link:
subject: Question about HttpRequestWrapper and HttpResponseWrapper