• 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

doFilter

 
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HFSJ 1st edtion: Page 696 Question 1.
a. Which are true for filters.
Answers:
B) The destroy method is always container callback.
D) The only way to invoke filter is through a declaration in DD.
Answer B.D
One more option.
C) The doFilter method is always a container call back method.

My questions
a) What is a container callback method? Does this mean it can be invoked only by the container and cant be invoked via code. If that is the case then B is wrong.

And since the answer B is correct acc to HSFS why is option C incorrect?
One more question regarding option C. The doFilter method of which interface Filter or FilterChain?

Please reply
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think a callback method means that the container will automatically call it within the lifecycle of a filter, which makes B true, since a container will call init(), doFilter() and destroy().

One more question regarding option C. The doFilter method of which interface Filter or FilterChain?



Exactly! That's what makes this question tricky I think. Because doFilter() can be called by FilterChain object, that makes it not "always a container call back method"

cheers
 
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic