标签:throws exception ons 过滤 set head date pre init
package fifter; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletResponse; @WebFilter("/*") public class AcheTest implements Filter { @Override public void destroy() { // TODO 自动生成的方法存根 } @Override public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException { HttpServletResponse resp = (HttpServletResponse) arg1; resp.setDateHeader("expires", -1); resp.setHeader("Cache-Control", "no-cache"); resp.setHeader("Pragma", "no-cache"); arg2.doFilter(arg0, arg1); // TODO 自动生成的方法存根 } @Override public void init(FilterConfig arg0) throws ServletException { // TODO 自动生成的方法存根 } }
标签:throws exception ons 过滤 set head date pre init
原文地址:http://www.cnblogs.com/javaweb2/p/6247513.html