next time i want to test private methods again, remember the answer to this....
Answer in Stack Overflow
Answer in Stack Overflow
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.http.HttpServletResponse; /** * * adds the no caching directives into the http response header * see: * http://en.wikipedia.org/wiki/List_of_HTTP_headers * http://www.i18nguy.com/markup/metatags.html * */ public class NoCachingFilter implements Filter { private static final String CACHE_CONTROL_PARAM ="Cache-Control"; private static final String CACHE_CONTROL_VALUE ="no-cache"; private static final String PRAGMA_PARAM = "Pragma"; private static final String PRAGMA_VALUE = "no-cache"; private static final String EXPIRES_PARAM = "Expires"; private static final int EXPIRES_VALUE = 0; private FilterConfig filterConfig = null; public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; } public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletResponse response = (HttpServletResponse) servletResponse; response.setHeader(CACHE_CONTROL_PARAM,CACHE_CONTROL_VALUE); response.setHeader(PRAGMA_PARAM,PRAGMA_VALUE); response.setIntHeader(EXPIRES_PARAM,EXPIRES_VALUE); // continue with remaining filters filterChain.doFilter(servletRequest, servletResponse); //note: must be done before else the response is already commited. } public void destroy() { filterConfig = null; } }That was mistake number 2. After a round of testing, we discovered that some of our file downloads would not work, namely, we ran into this internet explorer bug.
Internet Explorer file downloads over SSL do not work with the cache control headers. This issue may occur if any one or more of the following conditions are true: The Do not save encrypted pages to disk check box is selected in Internet Explorer 6.0 SP1. The server sends the "Cache-Control: No Store" header. The server sends the "Cache-Control: No Cache" header.
Are you using the Cache-Control header with the ASP "Response.CacheControl" property or through a returned HTTP header? This is the only way to truly prevent caching in Internet Explorer