jQuery in Action, 3rd edition
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes filter execution sequence question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "filter execution sequence question" Watch "filter execution sequence question" New topic

filter execution sequence question

Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277

Given the following deployment descriptor, identify the sequence of fi lters that execute on a
direct client request for ServletA. (Choose one.)

A. LogFilter, AuditFilter, EncryptionFilter
B. LogFilter, EncryptionFilter
C. LogFilter
D. EncryptionFilter, AuditFilter, LogFilter
E. EncryptionFilter, LogFilter
F. AuditFilter, EncryptionFilter, LogFilter

This is what i want to say - The client can request by using these url patterns - /* or /ServletA. Now keeping in mind that filters with <url-pattern> are executed before those with <ervlet-name>, the sequence of filter execution should be as given in option F. But the book (David Bridgewater-page 234) this -

E is the correct answer. First, the processing works through the filter-mappings with a matching URL pattern. EncryptionFilter runs because the URL pattern of �/*� matches any request. Then processing works through the filter mappings with matching servlet names.LogFilter has a matching name, so it executes. Note that filters mapped by URL pattern are
executed before filters mapped by servlet name.

What pricks me is that in light of the things given in head first's filter chapter, we are not able to answer this question.

the mock on filter in the HFSJ is also very very very weird. It is not at all releted to what is said in the text ! I never found HFSJ saying that the <url-pattern> like /* and / behave differently !!

Please help me out.

SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
Tha�s Manfrim Firmino
Ranch Hand

Joined: Apr 12, 2004
Posts: 48
I didn't understand: are you in doubt or not about that exercise? If yes, the correct answer is E because the client did a request and so the filter that only applies to forward won't execute.

Tha�s M. K. M. Firmino
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
i didnt get it !
somebody please explain more !
Celinio Fernandes
Ranch Hand

Joined: Jun 28, 2003
Posts: 549

The only thing left to say is that a "FORWARD value activates the filter for request dispatching from a forwar() call"

SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCBCD 5
Visit my blog
I agree. Here's the link: http://aspose.com/file-tools
subject: filter execution sequence question
It's not a secret anymore!