• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HttpServletRequestWrapper

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can some one please send me small note about HttpServletRequestWrapper from the Head First Book or anywhere else. I have only Servlet Spec with me. But there is not much info about that.
 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by muthulingam Jayakanthan:
can some one please send me small note about HttpServletRequestWrapper from the Head First Book or anywhere else. I have only Servlet Spec with me. But there is not much info about that.



The wrapper classes related to ServletRequest, ServletResponse, HttpServletRequest and HttpServletResponse are used when you want to expose to your clients an 'enhanced' version of the above objects. This is possible because a wrapper delegates to the 'official' object all the standard functionalities. This is possible because a wrapper normally should accept in its constructor an instance of the 'official' object. So it becomes easy for a wrapper having a reference to an instance of a certain class, and implementing its same interface, to invoke the 'official' object's methods (acting, that's it, as a wrapper). However, by extending a wrapper class, you can override only those methods for which you want to provide special functionalities. Then, from within the class from which you want to create the 'empowered' object, you will create an instance of the class extending the wrapper and you will pass this instance to whichever client of your empowered object.

The wrapper class is an implementation of the Decorator/Wrapper pattern.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic