concept DataResource in category gwt

appears as: DataResource, DataResource, The DataResource
GWT in Action

This is an excerpt from Manning's book GWT in Action.

In this chapter, we’ll explore all of the techniques used by ClientBundle to optimize resource delivery. We’ll start with the DataResource to learn the basics of using ClientBundle resources, and you’ll see ClientBundle’s use of both caching and embedding. We’ll then move on to the text resource types, where we’ll introduce you to resource bundling. Next, we’ll look at ImageResource, which uses all of the previously mentioned optimization techniques, but we’ll take some time to learn how to control ClientBundle’s use of these optimizations. Finally, we’ll explore CssResource, which adds minification, obfuscation, and selector merging to the optimization techniques used by ClientBundle.

The ClientBundle is an interface that defines methods to access any resources that you choose to load it with. For this example you’ll be loading a ClientBundle with DataResources, but the interface could easily define methods for any combination of resources that you’d like.

You use the resource type DataResource to bundle arbitrary file types. For instance, a DataResource could be an icon, or a PDF, or a Zip archive. As such, there’s no good way to extend GWT to optimize its inclusion in a ClientBundle, so it sticks to some basic noninvasive embedding or caching techniques that don’t require knowledge of the specific file type.

Listing 5.1. ClientBundle containing DataResources