Reputation: 65
Now I have a problem:
Now I want to implement scenario:
User must have cookie attribute with web app version.
By request I see it and in response force him to update page (don't know how).
If user's request can't be delivered gwt force him to update page (don't know how).
But I think there must be a best-practice-way to solve this problem.
Upvotes: 3
Views: 899
Reputation: 628
Another approach:
com.google.gwt.core.client.GWT.getPermutationStrongName();
in your LocalStorage
or in your Cookies
and finish the flow.GQuery - promises
). Then, replace in your LocalStorage
or Cookies
the new gwt's permutation id.You can do this always that your app is loaded (is not a big deal). And you can now when the version on your server has changed.
Upvotes: 0
Reputation: 64541
Catch IncompatibleRemoteServiceException
s and StatusCodeException
s in your AsynCallback
s. The first one tells you the client-side code is not compatible with the server-side code; the second can tell you that there no longer is a RPC servlet there (look for a 404
status code).
You can then show a message to the user prompting him to reload the page (this is what Google Groups does for example).
That said, there are some ways to mitigate this if the changes are relatively small: you can keep the old serialization policy files around server-side so the server can process requests from different client versions. The changes have to be somehow backwards compatible though.
You could then detect the client version on the server-side (either using a list of the latest serialization policy files and checking whether the client is using one of them or an older one; or using a request header or cookie) and include something in the response (response header or cookie) telling it there's a new version.
Or you could regularly poll the server (obviously not using RPC though) for the latest version of the app.
Upvotes: 6