This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Question Regarding Filters... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Question Regarding Filters..." Watch "Question Regarding Filters..." New topic

Question Regarding Filters...

Milesh Dcunha

Joined: Jun 19, 2006
Posts: 13
Which three are true about the HttpServletrequestWrapper Class?

A. the HttpServletRequestWrapper is an example of the Decorator pattern.

B. The HttpServletRequestWrapper can be used to extend the functionality of a servlet request.

C. A subclass of the HttpServletRequestWrapper CANNOT modify the behaviour of the getReader method.

D. An HttpServletRequestWrapper may be used only by a class implementing the javax.servlet.Filter interface.

E. An HttpServletRequestWrapper CANNOT be used on the request passed to the RequestDispatcher.include method. (this has to be FALSE)

F. An HttpServletRequestWrapper may modify the header of a request within an object implementing the javax.servlet.Filter interface.

Your answers will be appreciated. Thanking you in advance.

The world is becoming an orgy of self-sacrifice when it is precisely the self that should not be sacrificed.
Devendra Inamdar

Joined: Mar 25, 2006
Posts: 5
I think it shud be A,B and F
A- It's clearly Decorator pattern
B- When you extend HttpServletRequestWrapper, you are extending HttpServletRequest implementation.
F - A Filter should be able to modify the request header before passing it to servlet

Please correct me if I am wrong.
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

A and B are correct. F is probably the "correct" third answer, though you can't really alter the request's header. You can only change the behavior of the methods that return header information, making it appear as though the header were manipulated.

A good workman is known by his tools.
Milesh Dcunha

Joined: Jun 19, 2006
Posts: 13
Thank you !
I agree. Here's the link:
subject: Question Regarding Filters...
It's not a secret anymore!