• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help needed on Filters - page 700/Qtn 1

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need some clarification with the answers for this question.

c. The doFilter() can be called by the container and also the preceding filter. Is this what is meant my inline method?

Hence, it is not a container call back method only.

d. A filter can also be invoked by the preceding filter, in that case won't this option be incorrect?

Or, does "invoke" mean the very first filter to be invoked?

Thanks & regards,

Mani
 
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't understand your question. However here is the invocation mechanism :

Filters are used as a stack. At webapp deploy time, Container creates a list of Filters to be applied to request (check out rules, url-pattern before servlet-name...)
When one of theses "filtered requests" is requested, then the Filter, if applicable, is called (doFilter). After this, Filter has the end and may call the next filter (or servlet if it's the last filter in list) using its FilterChain doFilter() method. If next component is a Filter, calling FilterChain doFilter mehtod calls the next Filter's doFilter method.

Does this help?
 
Mani Jagathesan
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A filter can be invoked from the previous filter or by the container (if it matches the url patter/servlet etc,.).

In that case, option D would not be a correct answer for this question. Am I correct?

Option D says - The only way a filter can be invoked is through a declaration in DD.

Thanks for your help.
 
Frederic Esnault
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Mani Jagathesan
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, that was very helpful. Thanks very much.

Mani
 
Mani Jagathesan
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried a mock (one of the 'difficult') tests from J2EECertificate.com and the result was not encouraging. I am going through your notes (links in your signature) and they are very helpful, to the point.

Any tips would be very helpful.

Thanks,

Mani
 
Frederic Esnault
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry i didn't get your point. You want tips about what? About my notes or about questions in the difficult exam you took? I don't get it.

If you're afraid your level is too low, then try exams from whizlabs SCWCD simulator, or from Enthuware JWeb+, they have free mock i think. Or, but it should be good to keep this one for when you feel ready, take the HFSJ exam (knowing about the theorical "20% rule" (which worked for many of us)).

Does this help? If not, please make your question clearer and i'll be glad to help.
 
Mani Jagathesan
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Frederic,

Sorry I wasn't clear. I meant to ask for any tips on doing well in the real exam.

Your notes are very helpful. I plan to give the mock exams from J2EECertificate.com, JDiscuss.com and the HFSJ mock exam. I will let you know if I need more help.

Thanks again.
 
Frederic Esnault
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you read the HFSJ, used my notes , read the specs (mostly servlet specs, plus a JSP an JSTL read through) you should make sure you have a good understanding of how thing works, from a schematic overview to concepts. With a clear understanding, most of the questions are obvious, that's what you should work on.

And take your time, don't rush to the exam if you don't feel confident.

Good luck to you !
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic