Chapter 5. Using client bundles
This chapter covers
In this chapter we’ll take a look at how access to images, binary documents, text files, stylesheets, and other static resources GWT uses can be optimized at compile time through the use of the ClientBundle.
Typically, a web application will request each needed resource individually, making no attempt to bundle similar resources and requiring a new connection for each. Where load times are concerned, connection count is the enemy. Each connection requires a nontrivial amount of time to set up, so anything that you can do to reduce the number of connections required will help reduce an application’s load time. Think of it this way: if you were moving cross-country, would you drive each of your belongings individually, making hundreds of trips? Or would you carefully pack everything into a single truck and make the trip once? You could think of each of these cross-country trips as making a connection, and it’s pretty obvious that packing everything into a moving truck is more efficient. You can think of ClientBundle as GWT’s moving truck, but this moving truck knows a few tricks.
One technique used by ClientBundle to reduce connection count is resource embedding. This means adding the text or bytes of the resource to the main application payload.