• 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
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

doFilter

 
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
What are you doing? You are supposed to be reading this tiny ad!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic