Two Laptop Bag
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HttpServletRequestWrapper Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HttpServletRequestWrapper" Watch "HttpServletRequestWrapper" New topic


Ricardo Cortes
Ranch Hand

Joined: Jan 23, 2002
Posts: 140
Can someone shed some light as to when a developer would want to use this class? Actually, when would a developer want to use any of the wrapped request/response classes?

Sun Certified J2EE Architect for the J2EE Platform (Part 1)<br />Sun Certified Web Component Developer for the J2EE Platform<br />Sun Certified Programmer for the Java 2 Platform
Sam Cala
Ranch Hand

Joined: Jan 03, 2001
Posts: 147
When you want to provide your own functionality to any of the methods of HttpServletRequest/HttpServletResponse, you can use the wrapper classes. I mean if you want to set a content type of response, you can yourself give body to setContentType method of HttpServletResponse instead of just calling it.
This is what I suppose :roll: Someone pls. correct me if I'm wrong.

Best wishes,
Ricardo Cortes
Ranch Hand

Joined: Jan 23, 2002
Posts: 140
Hmm. Interesting. Why wouldn't a developer just subclass HttpServletRequest/HttpServletResponse instead?
Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
They are interfaces, implementing your own wrapper class from scratch is mostly trivial but incredibly tedious -- been there, done that.
- Peter
I agree. Here's the link:
subject: HttpServletRequestWrapper
It's not a secret anymore!