Can you reproduce in other browsers? We have similar problems only with Firefox.
2012/6/25 Jonas <[email protected]> > I am trying to implement the GWT "perfect caching" by using a custom javax > servlet filter. All files containing .nocache. should never be cached, and > files containing .cache. should be cached for a week. > > Here is the code for my filter: > > public class GWTCacheControlFilter implements Filter > { > @Override > public void destroy() > { > } > > @Override > public void init(final FilterConfig config) throws ServletException > { > } > > @Override > public final void doFilter(final ServletRequest request, final > ServletResponse response, final FilterChain filterChain) > throws IOException, ServletException > { > final HttpServletRequest httpRequest = (HttpServletRequest) > request; > final String requestURI = httpRequest.getRequestURI(); > > if (requestURI.contains(".nocache.")) > { > final Date now = new Date(); > final HttpServletResponse httpResponse = (HttpServletResponse) > response; > httpResponse.setDateHeader("Date", now.getTime()); > httpResponse.setDateHeader("Expires", now.getTime() - > 86400000L); > > httpResponse.setHeader("Pragma", "no-cache"); // HTTP 1.0 > httpResponse.setHeader("Cache-control", "no-cache, no-store, > must-revalidate"); // HTTP 1.1 > } > else if (requestURI.contains(".cache.")) > { > final HttpServletResponse httpResponse = (HttpServletResponse) > response; > httpResponse.setDateHeader("Expires", > System.currentTimeMillis() + 604800000L); // 1 week in future. > } > > filterChain.doFilter(request, response); > } > } > > When I reload the page I see in Firebug a 304 Not Modified status on my > initial myapp.nocache.js file, which sometimes leads to people seeing only > a white page after a new deploy. If I inspect the headers of the nocache > file I don't see any Expires-tag. > > The .cache. files seem to be cached correctly however (one week): > > Date: Mon, 25 Jun 2012 15:11:57 GMT > Expires: Mon, 02 Jul 2012 15:11:57 GMT > > I am using guice so in my servlet module I do: > > filter("*").through(GWTCacheControlFilter.class); > > However I have also tried adding the following to web.xml: > > <filter> > <filter-name>gwtCacheControlFilter</filter-name> > <filter-class>my.package.GWTCacheControlFilter</filter-class> > </filter> > > <filter-mapping> > <filter-name>gwtCacheControlFilter</filter-name> > <url-pattern>/*</url-pattern> > </filter-mapping> > > Anyone have some ideas what I am missing? I'm deploying using Glassfish > Open Source edition 3.1.1. > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-web-toolkit/-/5wb7eU-M3cUJ. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
