filter 过滤器 禁止浏览器缓存

 public class BrowserNoCacheFilter implements Filter {
public void init(FilterConfig filterconfig) throws ServletException {
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterchain) throws IOException, ServletException {
((HttpServletResponse) response).setHeader("Cache-Control", "no-cache"); //HTTP消息头,控制网页的缓存
((HttpServletResponse) response).setHeader("Pragma", "no-cache"); //禁止浏览器从缓存中调阅页面内容
((HttpServletResponse) response).setHeader("Expires", "-1"); //指定网页在缓存中的过期时间
filterchain.doFilter(request, response);
}
public void destroy() {
}
}
上一篇:SVN问题之——org.apache.subversion.javahl.ClientException: Attempted to lock an already-locked dir(网摘文)


下一篇:Missing Number-[回溯][难]