tags:

views:

246

answers:

0

I am trying to use Rome FeedFetcher to retrieve an RSS feed only if it has been updated. However, once the cache is created, it never seems to check the feed again. So if an item is added to the feed it isn't pulled down.

I turned on some logging and looked at:

feedFetcherCache.getFeedInfo(url).getLastModified()

for the url in question. Once the cache has been created the getLastModified value stays the same no matter how many times retrieveFeed is called or how many new items are added to the RSS feed has been updated.

Below is the code in question. Any suggestions would be appreciated.

FeedFetcher feedFetcher;
FeedFetcherCache feedFetcherCache;

//Constructor
public RSSAcquisition() {
 feedFetcherCache = HashMapFeedInfoCache.getInstance();
 feedFetcher = new HttpURLFeedFetcher(feedFetcherCache);
}

public void getNewLinks() throws Exception{
 SyndFeed feed = null;
 feed = feedFetcher.retrieveFeed(new URL(("http://www.example.com/feed"));
 List<SyndEntry> entries = feed.getEntries(); 
}