All About Filters

You don't have to change a web resource, such as a JSP page, HTML page, or a servlet, to log users who come to that resource, to restrict access to it, to alter the data sent to it, or to alter the data that comes back from it. All you need is a filter.

Creating a new filter isn't hard; it's just a Java class that implements the javax.servlet.Filter interface. You can see all the methods of this interface in Table 6.1.

Table 6.1. The Methods of the javax.servlet.Filter Interface
MethodDoes This
void destroy()Called to indicate that a filter is being destroyed
void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)Called when control is being passed to the filter
void init(FilterConfig filterConfig)Called to indicate that a filter is being initialized

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.76.135