I don't know why it works and what is wrong but I found a workaround which fixed the problem.
-- If I change the content of the nocache.js file after compilation (e.g. adding a CR or whitespace) and saving the file, then zipping the trunk folder, changing it to .war and deploying it in webapps on tomcat, the new "nocache.js" file will be updated correctly in the browser cache.
If I don't do this, no update will be done after the client loads the "nocache.js" (also if I try this with a newer version). The only way to get the application working again on client is to delete the browser cache. The "nocache.js" file still keeps always the same in cache.
If I change any other file in webapps directory on tomcat on runtime, the update in the appcache will be done as expected. e.g. I tested it with "compilation-mappings.txt"
Is this really a problem with the manifest update mechanism? Maybe a problem on file system (I use Ubuntu 14.04)?
I know this seems strange but I saw this behavior already with some html-files which I defined in my manifest file. Now this appears with the nocache.js ONLY on gwt 2.7 and higher? The next thing is, that this behavior is browser independent: Tested the same on Chrome 40 in Ubuntu 14.04 and Mobile Safari on iOS8.
Here is the js snippet from my index.html which looks periodically for updates (this works with the other files which I have defined in the manifest file) and executes them if any file from the manifest changed:
<script type="text/javascript" language="javascript">
//add all eventlistener
var cacheStatusValues = [];
cacheStatusValues[0] = 'uncached';
cacheStatusValues[1] = 'idle';
cacheStatusValues[2] = 'checking';
cacheStatusValues[3] = 'downloading';
cacheStatusValues[4] = 'updateready';
cacheStatusValues[5] = 'obsolete';
var cache = window.applicationCache;
cache.addEventListener('cached', logEvent, false);
cache.addEventListener('checking', logEvent, false);
cache.addEventListener('downloading', logEvent, false);
cache.addEventListener('error', logEvent, false);
cache.addEventListener('noupdate', logEvent, false);
cache.addEventListener('obsolete', logEvent, false);
cache.addEventListener('progress', logEvent, false);
cache.addEventListener('updateready', logEvent, false);
function logEvent(e) {
}
//if update cache was successfull, swap old cache
window.applicationCache.addEventListener('updateready',
function(){
window.applicationCache.swapCache();
//console.log('swap cache has been called');
},
false
);
//check if manifest file has changed and update cache
setInterval(function(){cache.update()}, 10000);
</script>
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment