GWT nocache filter
Hello all,
I am using GWT 2.2.0 for an application I started a year ago. And I
can't update now to lastest version. I use a filter on this
application and It works fine for IE8 but when I use it in Chrome
there are some RPC callbacks that don't work. This is the filter. Does
Someone know the reason?
[code]
package ea.ciges.gesres.server.filters;
import java.io.IOException;
import java.util.Date;
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.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* {@link Filter} to add cache control headers for GWT generated files
to
* ensure
*
* that the correct files get cached.
*
* @author See Wah Cheng
* @since 24 Feb 2009
*/
public class GWTCacheControlFilter implements Filter {
private static final long ONE_DAY = 86400000L;
public void destroy() {
}
public void init(FilterConfig config) throws ServletException {
}
public final void doFilter(ServletRequest request, ServletResponse
response,
FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
String requestURI = httpRequest.getRequestURI();
if (requestURI.contains(".nocache.")) {
Date now = new Date();
if (response instanceof HttpServletResponse){
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setDateHeader("Date", now.getTime()); // one day old
httpResponse.setDateHeader("Expires", now.getTime() - ONE_DAY);
httpResponse.setHeader("Pragma", "no-cache");
httpResponse.setHeader("Cache-control", "no-cache, no-store, must-
revalidate");
}
}
filterChain.doFilter(request, response);
}
}
[/code]
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home