|By Tamil Vengan, April 2, 2007|
The sample displays the latest news, weather, stock-quote, traffic, and map information; also the results of user-initiated searches for videos, blogs, and photos. Besides Ajax and a mashup, key to the development of the sample are Really Simple Syndication (RSS) software and public Web-service APIs from Google, Yahoo!, Flickr, YouTube, and
Upcoming.org. For details of the sample's capabilities, see the appendix, which also includes an 8-minute Flash demo.
You might want to first watch the demo to become acquainted with the application before stepping through the setup, compilation, and deployment procedures.
|-||Setting Up the Sample|
|-||Obtaining and Updating License Keys|
|-||Compiling the Sample|
|-||Deploying and Running the Sample|
|-||Appendix: The Sample|
First, download and set up the sample:
ajax.zipfile to the
Now sign up on and obtain license keys from the sites that offer the Web-service APIs:
1 This is a URL-based key. For example, if you designate your sample's URL as
http://localhost:84/ajax, request a key for the
The process is straightforward and takes only a few minutes.
The license keys that reside in the
AJAX_SAMPLE_DIR/docroot/js/setup.js file that you downloaded are for demos only. To run the sample, edit that file and update the license keys, as follows:
Variable Whose Value You Replace With That of Your License Key
Yahoo! Developer Network
Before compiling the sample, set two environment variables:
JAVA_HOMEenvironment variables to the location of the Java 2 Platform, Standard Edition (J2SE Platform) SDK 1.4 or a later release.
Now compile the sample,
AjaxServlet.java. The compilation involves the following JAR files:
AjaxServlet.java, that is, those in Web-Server-install-dir
/lib/pwc.jar, where Web-Server-install-dir is the location of Web Server 7.0, for example,
jdom.jar, all of which reside in the
AjaxServlet.java and create the Web archive (WAR) file:
% javac -classpathWeb-Server-install-dir
./docroot/WEB-INF/lib/googleapi.jar:./docroot/WEB-INF/lib/jdom.jar:. -d ./docroot/WEB-INF/classes AjaxServlet.java
AjaxServlet.class, to the
% cd docroot
% jar cvf ../ajax.war *
ajax.warfile resides under
ajax.war file from the Web Server 7.0 Administration Console, as follows:
ajax.warfile and type
/ajaxfor the URI. Click OK.
Finally, run the sample: Go to
/ajax, for example,
Watch this Flash demo of the sample.
A summary of the capabilities follows.
General UI and Settings
The sample displays a clock and a calendar at the top right corner. Note also these highlights:
Sorry not foundmessage.
Note these highlights:
Yahoo Weather is the default RSS feed for the Weather window. The sample displays a weather report for the location denoted by a U.S. zip code or address that you entered and updates the information after an elapsed refresh interval.
The default ZIP code is 95014. The default refresh interval is 5 minutes.
The Yahoo! Stock Quote Service supplies information for the Stock window. Note these highlights:
EBAY. The default refresh interval is 30 seconds.
The Yahoo traffic Representational State Transfer (REST) API supplies information for the Traffic window. Note these highlights:
The Google Maps API supplies information for the maps in the content window. Note these highlights:
The Google Ajax Search API supplies information for videos in the content window. Note these highlights:
Google Ajax Search API also supplies information for the blogs in the content window. Note these highlights:
The Flickr API supplies information about the photos in the content window. Note these highlights:
YouTube Video Search
The YouTube REST API supplies information for the YouTube Video search results in the content window. Note these highlights:
Upcoming.org) (Mashup) from the drop-down menu at the top.
pizza) in the right text field. Press Tab on your keyboard.
Ajax and mashups enable the creation of versatile and content-rich Web applications. Sun Java System Web Server, with its stability, scalability, and numerous capabilities that facilitate ease of development, is the best platform for developing and deploying such applications.