In this section, you'll:
You‘ll also learn about deferred binding, GWT’s mechanism for serving just the code required depending on browser or, optionally, other factors such as locale.
In the Eclipse console you will see the output of the GWT compiler, for example,
Compiling module com.google.gwt.sample.stockwatcher.StockWatcher Compiling 6 permutations Compiling permutation 0... Compiling permutation 1... Compiling permutation 2... Compiling permutation 3... Compiling permutation 4... Compiling permutation 5... Compile of permutations succeeded Linking into war/stockwatcher. Link succeeded Compilation succeeded -- 30.504s
You can compile the StockWatcher application directly from the command line:
Tip: If you launched the development mode server, you can run your application in production mode (after compiling it) by removing the
gwt.codesvr parameter from the URL before loading the application.
At this point, you could deploy StockWatcher to a public web server simply by uploading the files in the output directory. This initial version does not need to communicate with the server in any way; therefore, it does not require anything special on the part of the web server. Any server that can serve up static web pages will do just fine.
Take a look at the files generated by the GWT compiler. In the output directory StockWatcher/war/stockwatcher, you see a set of files similar to this:
1FCB598BF80A779999FF8774CEE9E224.cache.js 3880B6B217AFC67D6029EEBC02BDA651.cache.js 91F9F6B3066965A37C6ABEB2C3F0DE8C.cache.js clear.cache.gif compilation-mappings.txt F22DFAA06F25138FB07D27BA32BBE3F1.cache.js F90AE9A800297A50E40A5072EB33B368.cache.js gwt stockwatcher.devmode.js stockwatcher.nocache.js
At runtime, GWT uses a mechanism called deferred binding to load the correct permutation for the end user's browser. Deferred binding serves just the code the user needs and no more. What are the benefits of deferred binding? Because each permutation is tailored to work around the bugs and idiosyncrasies of its intended web browser, using deferred binding is
In addition to browser detection, deferred binding can also generate customized versions of your application for any number of other variables. One very common example is internationalization. With deferred binding, GWT generates a separate implementation of the application for each language, so for example, an English speaker doesn't have to download the French text (and vice versa).
You can try this for yourself in the tutorial Internationalizing a GWT Application.
At this point you've tested StockWatcher both in development mode and in production mode. By now you should have a pretty good idea of how to develop a GWT application, which has only client-side functionality, from start to finish.
To build upon the initial implementation of StockWatcher and learn additional features of GWT, select from the following tutorials: