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

Confusing terminology: Filter and Wrapper

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Page 699 of HFSJ book:

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

I think B is correct, but the answer given is A. The explanation given is "terminology reversed"!

Why do you need filters to create wrappers?
but you do use wrappers inside filters to send the wrapped Response to the next Filter or the servlet resource.

Where am I wrong here? Much help is appreciated.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a fine linguistical point, I guess.

You can't use wrappers to create filters - you'd use them to help implement filters.
 
author
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Warren,

The idea behind this mock item is that you need to create a filter before you can wrap the request/response objects. You said it yourself: "but you do use wrappers inside filters to send the wrapped Response to the next Filter or the servlet resource."

On the other hand you cannot create a filter just be using a wrapper around the request/response objects, which you could do inside of a servlet. In other words, creating a wrapper does not imply that you have created a filter.

Does that help?

-Bryan
 
warren li
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's clear to me now. Thank you.
reply
    Bookmark Topic Watch Topic
  • New Topic