Friday, March 23, 2012

Re: GWT nocache filter

Thanks, I'm going to try this and I tell you but thank you in advance

On 22 mar, 22:00, Jamie <jamiesharbor-sou...@yahoo.com> wrote:
> I use the same filter, with no problems.  However, my web.xml is
> probably configured a little differently:
> I remember from where I got that filter, it just applied it to every
> request.
> Instead of that, I only apply the filter to URLs that end in
> nocache.js like so - (note the url-pattern)
>
>   <filter>
>         <filter-name>NoCache</filter-name>
>         <filter-class>com.whatever.web.GWTCacheControlFilter</filter-class>
>   </filter>
>   <filter-mapping>
>     <filter-name>NoCache</filter-name>
>     <url-pattern>*nocache.js</url-pattern>
>   </filter-mapping>
>
> On Mar 20, 3:05 pm, SrArcos <srar...@gmail.com> wrote:
>
>
>
> > 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]- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -

--
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.

No comments:

Post a Comment