|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.syndication.fetcher.impl.AbstractFeedFetcher | +--com.sun.syndication.fetcher.impl.HttpURLFeedFetcher
Class to retrieve syndication files via HTTP.
If passed a FeedFetcherCacheI
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 FeedFetcherCacheI 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 SyndFeedI feed = new HttpURLFeedFetcher(feedInfoCache).retrieveFeed(feedUrl);
Field Summary |
Fields inherited from interface com.sun.syndication.fetcher.FeedFetcherI |
DEFAULT_USER_AGENT |
Constructor Summary | |
HttpURLFeedFetcher()
Constructor to use HttpURLFeedFetcher without caching of feeds |
|
HttpURLFeedFetcher(com.sun.syndication.fetcher.impl.FeedFetcherCacheI feedCache)
Constructor to enable HttpURLFeedFetcher to cache feeds |
Method Summary | |
com.sun.syndication.fetcher.impl.FeedFetcherCacheI |
getFeedInfoCache()
|
protected void |
handleErrorCodes(int responseCode)
Handles HTTP error codes. |
protected void |
resetFeedInfo(java.net.URL orignalUrl,
com.sun.syndication.fetcher.impl.SyndFeedInfo syndFeedInfo,
java.net.URLConnection connection)
|
protected void |
retrieveAndCacheFeed(java.net.URL feedUrl,
com.sun.syndication.fetcher.impl.SyndFeedInfo syndFeedInfo,
java.net.URLConnection connection)
|
com.sun.syndication.feed.synd.SyndFeedI |
retrieveFeed(java.net.URL feedUrl)
Retrieve a feed over HTTP |
void |
setFeedInfoCache(com.sun.syndication.fetcher.impl.FeedFetcherCacheI cache)
|
protected void |
setRequestHeaders(java.net.URLConnection connection,
com.sun.syndication.fetcher.impl.SyndFeedInfo syndFeedInfo)
Set appropriate HTTP headers, including conditional get and gzip encoding headers |
Methods inherited from class com.sun.syndication.fetcher.impl.AbstractFeedFetcher |
addFetcherEventListener, fireEvent, getUserAgent, removeFetcherPolledListener, setUserAgent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HttpURLFeedFetcher()
public HttpURLFeedFetcher(com.sun.syndication.fetcher.impl.FeedFetcherCacheI feedCache)
feedCache
- - an instance of the FeedFetcherCacheI interfaceMethod Detail |
public com.sun.syndication.feed.synd.SyndFeedI 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
SyndFeedI
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 handleErrorCodes(int responseCode) throws FetcherException
Handles HTTP error codes.
responseCode
- the HTTP response code
FetcherException
- if response code is in the range 400 to 599 inclusiveprotected void retrieveAndCacheFeed(java.net.URL feedUrl, com.sun.syndication.fetcher.impl.SyndFeedInfo syndFeedInfo, java.net.URLConnection 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, com.sun.syndication.fetcher.impl.SyndFeedInfo syndFeedInfo, java.net.URLConnection 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, com.sun.syndication.fetcher.impl.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 com.sun.syndication.fetcher.impl.FeedFetcherCacheI getFeedInfoCache()
public void setFeedInfoCache(com.sun.syndication.fetcher.impl.FeedFetcherCacheI 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 |