Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFS - page 703 Q 5 - ambiguous options

 
satguru srivastava
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q5 Option A: "Filters may be used to create request or response wrappers"
is marked as correct.
How does one create wrappers from filters ???

Q5 Option E: is marked incorrect
How else can one ensure that all filters will have a chance to excute ?
 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Satguru:
A - Your response filter can wrap the response (i.e. can add or modify the response). The example in HFS is the Compression Wrapper where the response is wrapped by a compression filter, so all requests matching the url-pattern you specify automagically get their responses compressed.

E - the key here is the word "must". You might have a filter that wants to stop certain requests from getting through. In this case you would not want to call doFilter since you would not want any further processing of the blocked request.
 
satguru srivastava
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roger,
I understand what the authors are trying to say.
My only point is that the answers can be interpreted in different ways and thus would be a bad choice in exam.
Thanks
Satguru
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dont worried about that, as the exam options would state clearly.

Nick
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy,
I agree with satguru about answer "E". I think it's poorly-worded and you should give yourself a point regardless of how you answer it, because of ways it can be interpreted.

To be 100% clear, it should have left out the last half of the sentence, and just say:

"E. A filter's doFilter() method must call doFilter() on the input FilterChain object."

The part that says, "... in order to ensure that all filters have a chance to execute." is the problem, because while you do not HAVE to call doFilter(), because as Roger said, you might want to stop processing, but if you DO want to ensure the other filters have a chance to execute, then you DO need to call doFilter(). So, this will be on our list of things to improve.

We think answer "A" is worded correctly, though.

Cheers,
Kathy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic