• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Confusing terminology: Filter and Wrapper

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • 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: 43016
76
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
It's clear to me now. Thank you.
    Bookmark Topic Watch Topic
  • New Topic