Pregunta

We are doing hotfixes/new releases every 2/3 days, so our users are experiencing that annoying "This application is out of date" message frequently. So, until we develop a way to check if app is out of date and force the reload, we would like to, at least, internationalize the message, as most of our users are not using english version of the app and looks weird.

Is there a way to i18n that "This application is out of date" message?

EDIT: As far as I've read, although I haven't tried it yet, maybe catching IncompatibleRemoteServiceException and doing the I18n there could do the trick. But we've lots of RPC calls... is there a nicer (yes, I mean easier and faster) way?

¿Fue útil?

Solución 2

I finally found a much better aproach (at least for my workflow). It consists in not informing user to reload, but avoid it.

The way I do that is by forcing browsers not to cache the *noncache.js file. This can be done by creating a filter and adding it to the app web.xml. The following is the doFilter() code.

if (requestURI.contains(".nocache.")) {
 Date now = new Date();
 HttpServletResponse httpResponse = (HttpServletResponse) response;
 httpResponse.setHeader("Pragma", "no-cache");
 httpResponse.setHeader("Cache-control", "no-cache, no-store, must-revalidate");
}
filterChain.doFilter(request, response);

Then, just add the filter mapping <url-pattern>/*</url-pattern> and you got it! Transparent changes to the user :D

Hope this helps.

Otros consejos

You can catch IncompatibleRemoteServiceExceptions globally using a GWT.UncaughtExceptionHandler. There, use an instanceof IncompatibleRemoteServiceException check and display whatever error message in whatever way to the user (e.g. Google Groups uses the same kind of "bubble" as for "loading…" and "your message has been sent" indicators, along with a "Reload" link).

Of course, that's if your AsyncCallbacks re-throw the exception.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top