Forums Register Login

From HFJS, coffee cram, some options

+Pie Number of slices to send: Send
1- Filter chain order is affected by whether filter mappings are declared
via <url-pattern> or via <servlet-name>. TRUE

I need clarification on this. Any input?

2- Filter supports an initialization mechanism that includes an init()
method that is guaranteed to be called before the filter is used to handle
requests.
FALSE

Is this incorrect due to bold line?


Thanks,
+Pie Number of slices to send: Send
1. Its true. As the filters mapped with url-pattern are lined up first and then filters mapped with servlet-name.

2. It looks confusing. But should be true.
+Pie Number of slices to send: Send
Hi Ranjeet,


A agree with what you say regarding Statement #1. My doubt is whether these
two things match (what you say and what is given there). Does that mean
something else.


I am still doubtful regarding statement #2. It is given false in the book.
If it is really false, I guess the reason is Filter does not handle the
client request. Not sure.

Thanks,
+Pie Number of slices to send: Send
Hi

In the filter life cycle there is no init() method.There is a method called init(FilterConfig).

So the statement is false.

Thanks

Anil Kumar
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
Thanks Christopher,

It was an errata.


Anil:

Kindly refer to page 78 of the Specification:


->Instantiate an instance of each event listener identified by a <listener>
element in the deployment descriptor.

->For instantiated listener instances that implement ServletContextListener,
call the contextInitialized() method.

->Instantiate an instance of each filter identified by a <filter> element
in the deployment descriptor and call each filter instance�s init()
method.


->Instantiate an instance of each servlet identified by a <servlet> element
that includes a <load-on-startup> element in the order defined by the
load-onstartup element values, and call each servlet instance�s init()
method.



Thanks,
+Pie Number of slices to send: Send
Hi

I have seen that,and i knew, but i am speaking about that particular question.

I am saying that ,that may be the reason...

Any way thanks

Thanks Christophe Verre for providing updated eratta


Thanks

Anil Kumar
[ August 07, 2007: Message edited by: anil kumar ]
+Pie Number of slices to send: Send
There is init() method apart from init(FilterConfig).

Is that correct (init() exits), as specification says or the question is
talking about init(FilterConfig) as Anil pointed out?


Thanks,
+Pie Number of slices to send: Send
Hi

If you consider the statements from specification the question is correct.But according to the subject or from head first book.we can sure that the answer is false.I thought that question as specific.I did not think that question as a general one.

If the same question appeared in exam i would go for false .Because there is no init() method in filer life cycle.

Let us wait and see what others comments on this.



Thanks

Anil Kumar
+Pie Number of slices to send: Send
Hi Anil,

I dont have the details of the question but looking at only the stmt and assuming that its referring to the init() method with the right argument the stmt looks true.

What do you say?

Thanks
+Pie Number of slices to send: Send
Hi

Sanjeet

if this is the statement
--------------------------------------------------------------------------
Filter supports an initialization mechanism that includes an
init(FilterConfig config) method that is guaranteed to be called before the filter is used to handle requests
-------------------------------------------------------------------------

Then the answer is true



Because according to the specification 2.4 .The container has to create an instance of the filter class and must call the init(FilterConfig config) at deployment time or just before processing the first request to the particular servlet or jsp.


Thanks

Anil Kumar
+Pie Number of slices to send: Send
Hi Anil,


HFJS errata says that option to be correct. In specification init() method is said to be called although there is no direct mention of init(), instead
init(FilterConfig) exits.

I wonder if this sort of confusing questions we encounter in the real exam,
it would be very difficult.


Thanks,
+Pie Number of slices to send: Send
This question has been debated quite often at the ranch. I sometimes say that there is no init() method. But the question seems to be asked in an awkward manner, and the errata of HFSJ has been updated accordingly.
Be sure that you won't get such an ambiguous question at the exam.
Die Fledermaus does not fear such a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 868 times.
Similar Threads
regarding filters and RequestDispather
Configuration of filter problem
Filters chain
Servlet Filter chain construction order
Spring security intercept-url question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 22:46:00.