About Question enthuware.jwpv6.2.1141 :
Moderators: Site Manager, fjwalraven
About Question enthuware.jwpv6.2.1141 :
Hi. Sorry for my English, it is not my native language. But I don`t understand, why the second answer is not true? Is it true that I should past the filter control code into doFilter method?
-
- Site Admin
- Posts: 10389
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1141 :
Usually, a filter calls, chain.doFilter(request, wrapper); at the end of its doFilter method, which passes the control to the actual resource that was requested by the client.
However, a filer may decide not to continue further processing of a request and in that case, it may choose not to call chain.doFilter(request, wrapper); at all. In this case, the actual resource (such as a JSP or Servlet) may not even be invoked.
So the point is, it is not a must for a filter to pass the control to the resource on which the filter is applied.
HTH,
Paul.
However, a filer may decide not to continue further processing of a request and in that case, it may choose not to call chain.doFilter(request, wrapper); at all. In this case, the actual resource (such as a JSP or Servlet) may not even be invoked.
So the point is, it is not a must for a filter to pass the control to the resource on which the filter is applied.
HTH,
Paul.
-
- Posts: 12
- Joined: Tue Mar 26, 2013 2:38 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1141 :
Hi,
Just a little stuff i've noticed
it's isPermanent() not "This happens only if the isParmanent attribute of the UnavailableException is true. Otherwise, the container will try to initialize it again after some time."
not an important point but for non native spoker it could be confusing
Sébastien
Just a little stuff i've noticed
it's isPermanent() not "This happens only if the isParmanent attribute of the UnavailableException is true. Otherwise, the container will try to initialize it again after some time."
not an important point but for non native spoker it could be confusing
Sébastien
-
- Site Admin
- Posts: 10389
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1141 :
Thank you, Sébastien. This has now been updated.
-Paul.
-Paul.
-
- Posts: 19
- Joined: Mon Sep 01, 2014 9:45 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1141 :
Hello .
Could you please explain why option 1 is valid?
"The init method of the filter is called only once before a request is made to the resource it is associated with."
This is from Java Doc. "The servlet container calls the init method exactly once after instantiating the filter. The init method must complete successfully before the filter is asked to do any filtering work." What means for me that the init() method has nothing with with actually "called once before a request is made" since no matter is there is any call to resource or no calls att all to the resource. As for me the answer looks like "init() only called once at first request to the resource" which is ambigous and not correct.
Thanks for help.
Could you please explain why option 1 is valid?
"The init method of the filter is called only once before a request is made to the resource it is associated with."
This is from Java Doc. "The servlet container calls the init method exactly once after instantiating the filter. The init method must complete successfully before the filter is asked to do any filtering work." What means for me that the init() method has nothing with with actually "called once before a request is made" since no matter is there is any call to resource or no calls att all to the resource. As for me the answer looks like "init() only called once at first request to the resource" which is ambigous and not correct.
Thanks for help.
-
- Site Admin
- Posts: 10389
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1141 :
You are right. Although the option is trying to get at the same point but I can see why it can interpreted differently. It has now been updated.
thank you for your feedback!
Paul.
thank you for your feedback!
Paul.
Who is online
Users browsing this forum: No registered users and 17 guests