Explain Life cycle of Servlet Filter.
Answer Posted / sunita
filters life cycle:
The life cycle of a filter is managed by a container. Every
filter must implement the Filter interface. The life cycle
of a filter consists of implementing the following methods:
1. init(): This method is called only once after
instantiation to perform any initialization task.
2. doFilter(): This method is called after the init()
method. It takes three arguments, namely a ServletRequest, a
ServletResponse, and a FilterChain. It is called each time a
filter needs to perform any function. This method performs
the actual work of a filter, either modifying the request or
the response.
3. destroy(): This method is used to perform any cleanup
operation before the container removes a filter instance.
| Is This Answer Correct ? | 36 Yes | 2 No |
Post New Answer View All Answers
How would you detect a keypress in a jcombobox?
How a component can be placed on Windows?
When a thread blocks on i/o, what state does it enter?
Why are my checkboxes not being set from on to off?
If your ui seems to freeze periodically, what might be a likely reason?
Difference between DurableSubscription and non- DurableSubscription?
Can I run seam with jdk 1.4 and earlier?
whats is statement and procedure
Which characters may be used as the second character of an identifier, but not as the first character of an identifier?
What are the diff types of exception?
what is Activation Instantinator?
Can I run seam outside of jboss as?
Can I use multiple html form elements with the same name?
Why do threads block on i/o?
difference between ejb,struts,hibernate,spring and jsp