• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Filters

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Page 699 HF Servlets and JSP
Ques 5

Which about Filters is true


A. Filters may be used to create request and response wrappers.
B. Wrappers may be used to create request or reponse filters

Shouldn't B be correct instead of A
Correct Ans given in book is A
 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also had the same problem the first time, then I understood. Thanks to filter, it's possible to create a 'wrapper' around a request/response objects. Filters use wrappers but it's not the other way round. Think of a filter to compress the response. The filter uses the HttpServletResponseWrapper class to actually pass behind the scenes a custom response object whose getOutputStream() method returns a custom output stream in gzip format. It's the filter which knows about the wrapper and not the other way round.

Hope this helps
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic