Using this template you can design a simple Filter class.

A filter implements javax.servlet.Filter and defines its three methods:

The server calls setFilterConfig() once to prepare the filter for service, then calls doFilter() any number of times for various requests.
The FilterConfig interface has methods to retrieve the filter's name, its init parameters, and the active servlet context.

Each filter receives in its doFilter() method the current request and response objects, as well as a FilterChain containing the filters that still must be processed.
In the doFilter() method, a filter may do what it wants with the request and response objects(see the doBeforeProcessing method). The filter then calls chain.doFilter() to transfer control to the next filter. When that call returns, a filter can, at the end of its own doFilter() method, perform additional work on the request/response objects(see the doAfterProcessing method).

The most important methods that should be implemented in this template are :