gwt browser interaction

First, the user enters the URL of your application, which triggers the browser to
request the application’s HTML file. The HTML downloads a specifically named
nocache.js file—the so-called bootstrap file. The bootstrap code determines which specific permutation of your application in JavaScript is required and then requests it.
When the permutation is loaded, the bootstrap calls the compiled onModuleLoad method from the EntryPoint and the application starts.

gwt browser interaction

gwt browser interaction

The non-cache.js which is mentioned above, contains the cached html file name. if it it there, loaded it, otherwise, request from server:

You’ll have noticed in the deployable part of the application some strange filenames, such as 1D94FD19D212152F48C6F39017347DC8.cache.html. These are the JavaScript implementations of your application that the compiler creates and names. Within the bootstrap code of your application (also created by the compiler), the correct file will be requested.
By naming these files using an MD5 hashing algorithm, GWT ensures two things:
1. The browser can cache the file with no confusion. The next time you run the
application, the startup is even faster.

2. If you recompile, then the bootstrap code will force the browser to load the new version of your application (because it will be asking for a new filename). The
next time you run

It’s as simple as that.

Prevent nocache.js being cached

When a new release comes, we might deploy some new features so the xxx.cache.html content would change. However if the user’s browser still caches the nocache.js, then the new xxx.cache.html would not be able to be downloaded by user.

To prevent this, you can append a UUID to the nocache.js url so that every time the html/jsp is downloaded, it always get the nocache.js downloaded.

<%@ page import="java.util.UUID" %>
<script type="text/javascript" language="javascript" src="gwt_YOURAPP/gwt_YOURAPP.nocache.js?<%=UUID.randomUUID().toString()%>"></script>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s