|
| 1 | +package com.crazyjava.filter; |
| 2 | + |
| 3 | +import java.io.IOException; |
| 4 | +import javax.servlet.Filter; |
| 5 | +import javax.servlet.FilterChain; |
| 6 | +import javax.servlet.FilterConfig; |
| 7 | +import javax.servlet.ServletException; |
| 8 | +import javax.servlet.ServletRequest; |
| 9 | +import javax.servlet.ServletResponse; |
| 10 | +import javax.servlet.annotation.WebFilter; |
| 11 | + |
| 12 | +/** |
| 13 | + * Servlet Filter implementation class SimpleFilter |
| 14 | + */ |
| 15 | +@WebFilter("/SimpleFilter") |
| 16 | +public class SimpleFilter implements Filter { |
| 17 | + |
| 18 | + /** |
| 19 | + * @see Filter#init(FilterConfig) |
| 20 | + */ |
| 21 | + public void init(FilterConfig fConfig) throws ServletException { |
| 22 | + // TODO Auto-generated method stub |
| 23 | + String initParam=fConfig.getInitParameter("ref"); |
| 24 | + } |
| 25 | + /** |
| 26 | + * Default constructor. |
| 27 | + */ |
| 28 | + public SimpleFilter() { |
| 29 | + // TODO Auto-generated constructor stub |
| 30 | + } |
| 31 | + |
| 32 | + /** |
| 33 | + * @see Filter#destroy() |
| 34 | + */ |
| 35 | + public void destroy() { |
| 36 | + // TODO Auto-generated method stub |
| 37 | + } |
| 38 | + |
| 39 | + /** |
| 40 | + * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) |
| 41 | + */ |
| 42 | + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { |
| 43 | + // TODO Auto-generated method stub |
| 44 | + // place your code here |
| 45 | + |
| 46 | + // pass the request along the filter chain |
| 47 | + chain.doFilter(request, response); |
| 48 | + } |
| 49 | + |
| 50 | + |
| 51 | +} |
0 commit comments