Yuta's Weblog

All | Personal | Sun
« 前の日(Oct月 1日, 2006年) | 日付別メイン | 次の日(Oct月 3日, 2006年) »

20061002 2006年 10月 02日 月曜日

New RSS Bar in Pet Store 2.0 EA3
-- This blog was revised on 10/06 as there might be some confusions --

The latest version(early access 3.0) of Pet Store 2.0 was just released. You can download from here. If you have ever tried Pet Store 2.0, you know it utilizes the library jar from BluePrints Solutions Catalog which contains various JavaServer Faces component with AJAX capabilities. In this version, we rewrote the RSS component in the library jar to use ROME to process the RSS feed xml instead of XSLT. Also we are using ROME Fetcher for retrieving the XML itself. For those who don't know Fetcher, it fetches XML via http(and https of course) and it supports HTTP conditional gets (ie: last modified and ETag handling) and GZip encoded feeds. All changes were about the logic of retrieving and processing XML, so there is no change in the tag of JavaServer Faces component to generate all necessary mechanism for the client side HTML and javascript. Also there's no change in the Pet Store 2.0 RSS bar code itself.

Using ROME

Using ROME is extremely easy. If you don't have to care what the format of the original feed(a bunch of versions of RSS and Atom), basically you can just do the following to fetch the feed:-

    FeedFetcherCache syndFeed = new HashMapFeedInfoCache();
    FeedFetcher feedFetcher = new HttpURLFeedFetcher(feedInfoCache);
    /* attach listener here if you need to change the behavior of
     * response from the server
     */
    SyndFeed syndFeed = feedFetcher.retrieveFeed(new URL(urlString));

then to process the feed:-

    syndFeed.getTitle()  // get the title of Feed title
    List <SyndEntry> entries = syndFeed.getEntries();
    for (SyndEntry entry : entries) {
        entry.getTitle();  // get the title of each entry in the feed
    }

The current RSS component generates the JSON from the feed and sends back to the client, then the client side javascript processes it and displays in a ticker. All of those back-end process is done in the managed bean's method which is called by the javascript via shale-remoting. There are some new features in this version of Pet Store 2.0, such as tagging. So please check that out! Posted by yuta ( 10月 02日 2006年, 03:00:58 午後 PDT ) Permalink 投稿されたコメント [0]


Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.