Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question Regarding Filters...

 
Milesh Dcunha
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Devendra Inamdar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Dev
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Milesh Dcunha
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic