user_1357
user_1357

Reputation: 7940

GWT application freezes when new version is deployed while using it

While using the GWT application, I deployed the new version of the application. Once deployment is complete my application freezes until I do the full refresh. I originally thought this was caching problem, so I assigned all the files to be no-cache by setting all response headers using the filter. But still with this filter application freezes when I deploy a new version.

What could be a cause of this?

What I am trying to achieve here is to be able to deploy a new version of GWT application while user is using the application. This means when the JavaScript changes I want user to get it from the server instead of using the cached one without any glitch (maybe slow response time since request need to go to the server in this case).

Note: This is observed when deployed with the changes in the code, so I am guessing one of the cache.js file. When deployed without any changes to a code this is not observed.

Upvotes: 0

Views: 677

Answers (3)

Blessed Geek
Blessed Geek

Reputation: 21614

Your question is not clear because it does not tell which situation you are in:

  1. You deploy the new GWT app and you want the new server-side to respond to the old client-side.

  2. You deploy the new GWT app and you want the client browser to immediately replace the GWT client with the new version.

I would like to speak about situation 2, first. I am thinking you came from a background of servlets and JSP, plus dynamically generated HTML and Javascript. In those env, the client is immediately replaced everytime your client places requests the server. That is because the client UI is refreshed by new response generated by the server.

In GWT, the root panel is not refreshed. The root panel is held by the hosting html page. If the hosting html page is not refreshed, the GWT client will forever be the old version. That is the very idea of AJAX and GWT. You don't want to have to refresh the web page and yet allowing the web page to continuously emit/receiv async requests/responses.

You might be reminded that GWT is compiled into javascript.

In order to get the new version, you have to refresh the web page. There is no way in GWT technology for the new javascript to sneak into the browser to replace the old sets of javascript, unless you refresh the page.

The script tag source link is already read when the GWT javascripts are loaded. Those links will not be reread unless you refresh the page. If those links are not re-read, then the new javascripts will never be reloaded.

You need to detach your JSP/servlet experience when dealing with AJAX.

Back to situation 1 ..

Since the new GWT UI version was not loaded, because you did not perform a refresh, you would have incongruences between the data structure expected by the old UI version with that of the new server-side version. If you can guarantee the stability of RPC or client-server data structure and sequences of exchange, I believe you should not have a problem.

However, with GAE, the serialization id is important. You may have changed the data structure of a POJO without updating the serialization id. That would confuse the GAE client-server traffic, because ... hmmm ... I can faintly recall the exact sequence of problem I had faced - You better read up on GAE pojo serialization id yourself.

Upvotes: 2

Adel Boutros
Adel Boutros

Reputation: 10285

The problem is from your web server not the GWT itself. You should see if your Web Server supports hot-deployment or not and how it works with it.

UPDATE : For example Tomcat prior to version 7 does not support Hot-deployment and you have to restart the server on every update whereas Tomcat 7 supports Hot-deployment and you only have to reload the page to get the new module.

Upvotes: 1

Jama A.
Jama A.

Reputation: 16079

I also had such problem. In such case you should have one table which keeps every new upload information. And also you should have one async request (maybe in your EntryPoint) for checking whether you have new upload or not.

 public void success(String version) {
    if(!Cookies.getCookie("version").equals(version)){
         Window.open(currentUrl, "_self", "");
    }
 }

This is what i've done and working without any problem...

Upvotes: 1

Related Questions