iOS 6 Bug: Safari caches POST requests

已查看 1,466 次
跳至第一个未读帖子

KevMo

未读,
2012年9月23日 02:17:102012/9/23
收件人 google-we...@googlegroups.com
I'm not sure how many people this will affect, but I thought I would send out a heads up. Check out these posts for more information:

Jens

未读,
2012年9月23日 08:31:542012/9/23
收件人 google-we...@googlegroups.com
Thanks. Good to know.

-- J.

Christian Kuetbach

未读,
2012年9月27日 05:35:532012/9/27
收件人 Google-We...@googlegroups.com
Implement a Header-Filter:

public class HeaderFilter implements Filter {

public void destroy() {
}

public void doFilter(ServletRequest req, ServletResponse res,
FilterChain filterChain)
throws IOException, ServletException {

HttpServletResponse response = (HttpServletResponse) res;
response.addHeader("Cache-Control", "no-cache");
filterChain.doFilter(req, res);
}

public void init(FilterConfig arg0) throws ServletException {
}

}


If you set this filter to filter all your reqests to your dispatch-servlet,
no results should be cached.


Regards,
Christian Kuetbach

Nicolas Hoby

未读,
2012年10月2日 12:42:232012/10/2
收件人 Google Web Toolkit
Works perfect, thank you!

Just for completion, to install the filter add the following to your
Web.xml:

<filter>
<filter-name>HeaderFilter</filter-name>
<filter-class>server.services.HeaderFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HeaderFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

Jeffrey Roe

未读,
2012年11月2日 14:03:012012/11/2
收件人 google-we...@googlegroups.com
So this will cause all files to be downloaded over and over again.
Is there a way to do this fix just for IOS devices.
Jeffrey Roe,
> --
> 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-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>

Jamie

未读,
2012年11月2日 16:43:412012/11/2
收件人 google-we...@googlegroups.com
You could write the filter to only affect POSTs
Or, you could configure the filter mapping to only apply the filter to your Servlet(s).

Jamie.
> To unsubscribe from this group, send email to google-web-toolkit+unsub...@googlegroups.com.

Joseph Lust

未读,
2012年11月3日 12:05:402012/11/3
收件人 google-we...@googlegroups.com
Of course you can just do this for iOS devices. Just parse the UserAgent parameter from the request.

Sincerely,
Joseph

Rob Whiteside

未读,
2012年11月5日 15:32:192012/11/5
收件人 google-we...@googlegroups.com
We came across this problem too, I was banging my head against the wall for hours.

I see some others solved it with filters, if you use apache you can mess with the headers via the Headers Module.  Add the following to the httpd.conf:

LoadModule headers_module modules/mod_headers.so

.......

<Location /yourgwtapp/gwtRequest>
Header set Cache-Control no-cache
</Location>

That will add set the headers for any response at that location.  For us, that was the GWT Request Factory endpoint.

Óscar Frías Barranco

未读,
2012年11月6日 05:19:342012/11/6
收件人 google-we...@googlegroups.com
Hello.

We just override the method onAfterResponseSerialized from RemoteServiceServlet in the RPC services implementation and this fixes this issue:

    @Override
    protected void onAfterResponseSerialized(String serializedResponse) {
        HttpServletResponse response = getThreadLocalResponse();
        response.setDateHeader("Expires", 0L);  // always expired
        response.setHeader("Cache-Control", "no-cache");
    }

Regards,
Oscar



El domingo, 23 de septiembre de 2012 10:10:35 UTC+2, Rui Oliveira escribió:
Hi,

Whats the best away to solve this issue? I have hundreds of RPC and I'm looking for a global way to change the header to no-cache.

Sincerely

Rui 
回复全部
回复作者
转发
0 个新帖子