Filter

public interface Filter {

	// 由web容器调用
	public void init(FilterConfig filterConfig) throws ServletException;

	/**
	 * A typical implementation of this method would follow the following
	 * pattern:- <br>
	 * 1. Examine the request<br>
	 * 2. Optionally wrap the request object with a custom implementation to
	 * filter content or headers for input filtering <br>
	 * 3. Optionally wrap the response object with a custom implementation to
	 * filter content or headers for output filtering <br>
	 * 4. a) <strong>Either</strong> invoke the next entity in the chain using
	 * the FilterChain object (<code>chain.doFilter()</code>), <br>
	 * 4. b) <strong>or</strong> not pass on the request/response pair to the
	 * next entity in the filter chain to block the request processing<br>
	 * 5. Directly set headers on the response after invocation of the next
	 * entity in the filter chain.
	 **/
	
	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException;

	public void destroy();

}
 

你可能感兴趣的:(filter)