• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

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
 
We can walk to school together. And we can both read this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic