doFilter method. Every Filter has access to
a FilterConfig object from which it can obtain its initialization parameters, a
reference to the ServletContext which it can use, for example, to load resources
needed for filtering tasks.
Filters are configured in the deployment descriptor of a web application
Examples that have been identified for this design are
1) Authentication Filters
2) Logging and Auditing Filters
3) Image conversion Filters
4) Data compression Filters
5) Encryption Filters
6) Tokenizing Filters
7) Filters that trigger resource access events
8) XSL/T filters
9) Mime-type chain Filter
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
The |
| public void | init(FilterConfig filterConfig)
Called by the web container to indicate to a filter that it is being placed into service. |
| destroy | back to summary |
|---|---|
| public void destroy() Called by the web container to indicate to a filter that it is being taken out of service. This
method is only called once all threads within the filter's doFilter method have exited or after
a timeout period has passed. After the web container calls this method, it will not call the
doFilter method again on this instance of the filter. | |
| doFilter | back to summary |
|---|---|
| public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException The
A typical implementation of this method would follow the following pattern:- | |
| init | back to summary |
|---|---|
| public void init(FilterConfig filterConfig) throws ServletException Called by the web container to indicate to a filter that it is being placed into
service. 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. | |