|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.syndication.fetcher.impl.AbstractFeedFetcher
com.sun.syndication.fetcher.impl.HttpURLFeedFetcher
public class HttpURLFeedFetcher
Class to retrieve syndication files via HTTP.
If passed a FeedFetcherCache
in the
constructor it will use conditional gets to only retrieve modified content.
The class uses the Accept-Encoding: gzip header to retrieve gzipped feeds where supported by the server.
Simple usage:
// create the cache FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getFeedInfoCache(); // retrieve the feed the first time // any subsequent request will use conditional gets and only // retrieve the resource if it has changed SyndFeed feed = new HttpURLFeedFetcher(feedInfoCache).retrieveFeed(feedUrl);
Field Summary |
---|
Fields inherited from interface com.sun.syndication.fetcher.FeedFetcher |
---|
DEFAULT_USER_AGENT |
Constructor Summary | |
---|---|
HttpURLFeedFetcher()
Constructor to use HttpURLFeedFetcher without caching of feeds |
|
HttpURLFeedFetcher(FeedFetcherCache feedInfoCache)
Constructor to enable HttpURLFeedFetcher to cache feeds |
Method Summary | |
---|---|
FeedFetcherCache |
getFeedInfoCache()
|
protected void |
resetFeedInfo(java.net.URL orignalUrl,
SyndFeedInfo syndFeedInfo,
java.net.HttpURLConnection connection)
|
protected void |
retrieveAndCacheFeed(java.net.URL feedUrl,
SyndFeedInfo syndFeedInfo,
java.net.HttpURLConnection connection)
|
com.sun.syndication.feed.synd.SyndFeed |
retrieveFeed(java.net.URL feedUrl)
Retrieve a feed over HTTP |
void |
setFeedInfoCache(FeedFetcherCache cache)
|
protected void |
setRequestHeaders(java.net.URLConnection connection,
SyndFeedInfo syndFeedInfo)
Set appropriate HTTP headers, including conditional get and gzip encoding headers |
Methods inherited from class com.sun.syndication.fetcher.impl.AbstractFeedFetcher |
---|
addFetcherEventListener, combineFeeds, fireEvent, fireEvent, fireEvent, fireEvent, getUserAgent, handleErrorCodes, isPreserveWireFeed, isUsingDeltaEncoding, removeFetcherEventListener, setPreserveWireFeed, setUserAgent, setUsingDeltaEncoding, throw4XXError, throwAuthenticationError |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HttpURLFeedFetcher()
public HttpURLFeedFetcher(FeedFetcherCache feedInfoCache)
feedCache
- - an instance of the FeedFetcherCache interfaceMethod Detail |
---|
public com.sun.syndication.feed.synd.SyndFeed retrieveFeed(java.net.URL feedUrl) throws java.lang.IllegalArgumentException, java.io.IOException, com.sun.syndication.io.FeedException, FetcherException
feedUrl
- A non-null URL of a RSS/Atom feed to retrieve
SyndFeed
object
java.lang.IllegalArgumentException
- if the URL is null;
java.io.IOException
- if a TCP error occurs
com.sun.syndication.io.FeedException
- if the feed is not valid
FetcherException
- if a HTTP error occurredprotected void retrieveAndCacheFeed(java.net.URL feedUrl, SyndFeedInfo syndFeedInfo, java.net.HttpURLConnection connection) throws java.lang.IllegalArgumentException, com.sun.syndication.io.FeedException, FetcherException, java.io.IOException
java.lang.IllegalArgumentException
com.sun.syndication.io.FeedException
FetcherException
java.io.IOException
protected void resetFeedInfo(java.net.URL orignalUrl, SyndFeedInfo syndFeedInfo, java.net.HttpURLConnection connection) throws java.lang.IllegalArgumentException, java.io.IOException, com.sun.syndication.io.FeedException
java.lang.IllegalArgumentException
java.io.IOException
com.sun.syndication.io.FeedException
protected void setRequestHeaders(java.net.URLConnection connection, SyndFeedInfo syndFeedInfo)
Set appropriate HTTP headers, including conditional get and gzip encoding headers
connection
- A URLConnectionsyndFeedInfo
- The SyndFeedInfo for the feed to be retrieved. May be nullpublic FeedFetcherCache getFeedInfoCache()
public void setFeedInfoCache(FeedFetcherCache cache)
cache
- The cache to be used by this fetcher (pass null to stop using a cache)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |