• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Please answer the following HF question (Page 703) on filters

 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which about filters are true?

A- Filters may be used to create request or response wrappers
B- Wrappers may be used to create request or response filters

Correct answer is A (answer is on page 703)

Why is the answer is A? On what page should I look in order to see an example that Filters may be used to create request or response wrappers. I only see that you could extend wrappers.

I don't know if it's related but on page 689 it also shows that by extending an HttpServletResponseWrapper, the filter could get custom Response object that it sends to the servlet. Then that servlet could write output to that custom Response. So p689 doesn't try to show that filters may be used to create response wrappers.
[ December 24, 2006: Message edited by: Firas Zuriekat ]
 
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah...even I'm confused....how can a Filter be used to create Wrappers....as far as I know, you can subclass one of these Wrapper classes to obtain a custom response or request object which you pass to the chain.doFilter() method? That's it....I really fail to understand how Filter's can be used to create Wrapper's.

Could anyone please explain....Many thanks in advance.
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By extending wrapper classes,we are creating custom wrapper classes.

So if you have specified a filter which extends these wrappers then you are using filters to create custom wrappers
 
Tomorrow is the first day of the new metric calendar. Comfort me tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic