0

Hi my GWT application is working fine in PC browser, but RPC communication fails randomly in mobile / iPad browsers. It seems the very first RPC communication success in mobile / iPad but subsequent RPC calls fails. When I checked my server logs no exception at all. I am using Tomcat as server and Apache HTTPD to server static resource. Another observation is when multiple images are being loaded the RPC calls fails in my iPad.

Please help me on this.

1 Answers1

0

You have not provided a lot of information, but this "works first time, then fails" sounds like the cache behavior introduced in iOS6, IIRC.

To find out:

  1. Run the app into a non-working state.
  2. clear the cache in the browser settings (via system settings in iOS)
  3. Try the RPC call again.

If the call is suddenly working in step 3, you need to set the cache headers on your RPC servlets explicitely. We did this using a request filter that added the headers on the right paths.

We set

Cache-control: no-cache

This fixed the issue for us.

Find more information on the right cache settings here Is Safari on iOS 6 caching $.ajax results?

Community
  • 1
  • 1
thst
  • 4,592
  • 1
  • 26
  • 40
  • Hi thank you for your reply, as per my understanding GWT RPC uses POST method still cache required? if so how to set "Cache-control: no-cache" for RPC service? – Sivasankar Jul 02 '16 at 14:56
  • The iOS problem IS that some versions of Safari cache POST requests. As I already stated, we added a Request filter to add the header. – thst Jul 03 '16 at 18:50
  • Hi, this solved the problem in Windows phone but in iPad still my RPC fails randomly below is my filter setting implementing Filter long now = System.currentTimeMillis(); HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.setDateHeader("Date", now); httpResponse.setDateHeader("Expires", now - 86400000L); // one day old httpResponse.setHeader("Pragma", "no-cache"); httpResponse.setHeader("Cache-control", "no-cache, no-store, must-revalidate, max-age=0, post-check=0, pre-check=0"); – Sivasankar Jul 26 '16 at 14:41
  • Hi you are right the problem is with cache setting by following your link I could able to overcome this issue. Thank you. – Sivasankar Sep 13 '16 at 07:56