Which about filters are true? (Choose all that apply.)
A. Filters may be used to create request or response wrappers.
B. Wrappers may be used to create request or response filters.
C. Unlike servlets, all filter initialization code should be placed in the constructor since there is no init() method.
D. Filters support an initialization mechanism that includes an init() method that is guaranteed to be called before the filter is used to handle requests.
E. A filter’s doFilter() method must call doFilter() on the input FilterChain object in order to ensure that all filters have a chance to execute. F. When calling doFilter() on the input FilterChain, a filter’s doFilter() method must pass in the same ServletRequest and ServletResponse objects that were passed into it.
G. A filter’s doFilter() may block further request processing.
I took this question from Head First SCWCD book.
The correct answers are ;
but I think the E is also correct ? Why E is not correct ?
But answer E clearly states that is merely necessary if you want to make sure all filters are called. And since a filter cannot know how many more filters will follow, I agree that calling doFilter on the FilterChain object is the only way to ensure that all filters have a change to execute.