12.4. Using the JSON API and JsonpRequestBuilder

In the last section we loaded content from our own website, but what if you want to load data from a remote site? In this age of mash-ups it’s useful to be able to load content from well-known content providers like Yahoo and Google using JSONP.

We covered the technical details of how JSONP works in section 12.1.3, so let’s get right into how to use the API. To begin, you should create a new project, and again the project name and root package don’t matter.

Next, you need to inherit two GWT packages so that you’ll have access to the JSONP tools. Add the following two lines to your module configuration file:

<inherits name='com.google.gwt.json.JSON'/> <inherits name='com.google.gwt.jsonp.Jsonp'/> ...

Get GWT in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.