aspose file tools*
The moose likes Servlets and the fly likes HttpServletResponseWrapper Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpServletResponseWrapper" Watch "HttpServletResponseWrapper" New topic
Author

HttpServletResponseWrapper

Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
I have looked this up, but I cannot seem to understand a good use for it. What exactly does it do? What would be soem advantages to using it? Can I get a real world commitment.
danny liu
Ranch Hand

Joined: Jan 22, 2004
Posts: 185
The functionalities of the general HttpServletRequest or HttpServletResponse are limited. If you wanna a customized function, you must wrapper them.
e.g., if you wanna GZip the response message. You can create an instance of
a Wrapper response which includes the GZip compression feature. Afterwards, everything written into this wrapper is automatically Gzipped.
Hope it helps.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
There was a discussion here a few days ago where the Request Wrapper seemed like a useful idea.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
R. Shellbay
Greenhorn

Joined: Sep 19, 2003
Posts: 13
This approach is for instance used by the JSTL implementation of the import tag..
The tag does a .. include(request, ServletResponseWrapper ) instaed of the regular include(request, response).
The reason I guess is to better control the writing to the response object, and to have better control with the flushin of whatever is in the response object...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HttpServletResponseWrapper