O'Reilly logo

Real World Web Services by Will Iverson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Project 7: Hot News Sheet

If you’re like me, you start your day by sitting down to work and opening a suite of web sites, trying to get a sense of what’s going on in the world. In particular, I like to find both what’s deemed popular by the mainstream media, as well the more democratic and populist views of the weblog community.

In this chapter, you’ll build an application using RSS to provide a single web page showing what’s hot from the mainstream news and the weblog universe, side by side. The application will additionally fold in results from a Google search on these topics for yet another angle on the news.

Presenting the News

One of the interesting things about this particular application is that it makes a series of calls to a number of servers, and, therefore, can easily take 15 to 20 seconds to completely populate the data from the various systems. This is far too long for any user to wait for a page to load (and indeed, most web browsers will time out after this long a delay). Therefore, when the application first starts, it displays a notice to the user, as shown in Figure 10-1. This notice is returned to the user immediately, and the news is fetched on another thread (in this case, using the built-in JDK java.util.TimerTask service).

Waiting for the news
Figure 10-1. Waiting for the news

As shown in Figure 10-2, after the data has been loaded, the viewer can see the results of the search. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required