Java Reference
In-Depth Information
The remainder of the code deals with creating the GUI for the application by arranging the
image, the text box, and the button, as shown in the next screenshot. That code has been
omitted as you are trusted to review the respective recipes that deal with GUI creation in
previous chapters.
How it works...
In this recipe, we have built a RESTful mashup rich client application that displays a location
on a Google Map and real estate data for that location using Zillow web service API. The
previous code, snippet shows you how to pull down and parse an XML-encoded document
from a remote web server using the PullParser API. Let's review what is going on in the code:
F Global values —the first segment of the code declares global values used throughout
the code including the root URL's for the Google and Zillow services, API keys, a
default address used when the application first started.
F Data models —to pass data around in the application, we create classes Address
and ZillowListing as data model. The Address class provides a structured way
to capture address data passed in as parameters to the web service requests. The
ZillowListing class models the information returned by the Zillow web service.
ZillowListing extends the Address class because the listing information from
Zillow contains address data as well.
Convenience function createAddress(:String):Address creates an Address
object from a String value. This is valuable since both web services parameterize
the address information differently. The Address class provides a normalized view
of the address around the application.
Search WWH ::

Custom Search