• Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpServletResponseWrapper

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There was a discussion here a few days ago where the Request Wrapper seemed like a useful idea.
 
R. Shellbay
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!