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
What classes of exceptions may be caught by a catch clause?
Explain about thread synchronization inside a monitor?
What is the form of storage space in java?
What is a class loader? What are the different class loaders used by jvm?
What is threadfactory?
difference between ejb,struts,hibernate,spring and jsp
What class is the top of the awt event hierarchy?
What is the difference between session and entity beans?
What is clustering? What are the different algorithms used for clustering?
Java is fully object oriented languages or not?
Are we allowed to change the transaction isolation property in middle of a transaction?
Explain what is synchronization?
Is the infobus client side only?
What is the difference between the session.update() method and the session.lock() method?
How can I avoid validating a form before data is entered?