posted 18 years ago
No option D is correct. The spirit of this option, if it was false, is to say that there is another way (programmatically) to configure a Filter to be invoked when a servlet is requested. Which is not possible.
The FilterChain doFilter() method does not invoke a Filter, it just gives it the hand, until execution completes and hand comes back to the calling Filter ( remember the stack view of filters).
When you configure Filters in DD, Container builds a list of Filters it gives to a FilterChain object. The FilterChain object, when used to call next Filter, refers to Container list to "invoke" next one, which has been configured in DD.
I'm not sure of being really clear. The main point and "spirit" there is that Filters are loaded, instantiated, initialized and INVOKED only thanks to declaration in the DD. There is NO other way to configure/load/initialize or invoke a Filter.
The whole Filter mechanism is Container based (from the construction of the Filter list to the Filter chaining mechanism), and configured by DD declarations.
With this view in mind, option D is definitely correct.
Inline method means this method can be called by your code. A container callback method, the opposite, is a method that may only be called by the container, as an answer to an event.
Option A is incorrect, this is obvious.
Option C is not correct as it may be called by you, via the FilterChain.
And option E is not correct because filter chain is built by the container, at deploytime, and this is the only way to do so.
Was i clear?
SCJP 5 - SCWCD 1.4 - SCBCD 1.3 - Certification study documents/resources: http://esnault.frederic.free.fr/certification