public interface Filter
Developers must implement this interface for filtering code and
then cause their
Filters to be mapped to servlets or
url-patterns (normally by using a webapp's deployment descriptor).
When the server loads the filter it causes the
method to be called with the necessary config information (including
init parameters, specified in the webapp's DD perhaps).
When the server recieves requests that match the filter conditions
it calls the
doFilter() method of the first matching
filter. The remaining filters (and the target servlet) are passed in
FilterChain argument. The developer must call the
FilterChain.doFilter() method to pass the request on to
the next filter.
When the server has finished with the filter it calls the
destory() method after the filter has been removed
For more information see section 6 of the Servlet API 2.3 specification.
for more information on how the chains work
void init(FilterConfig init) throws ServletException
init- the filter's configuration information (including init params)
void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, java.io.IOException
request- the request to be filtered
response- the response to be filtered
chain- the remaining filters (and the target servlet) in the request chain