|
|||||||||||
| 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
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 | |
private FeedFetcherCache |
feedInfoCache
|
private IProgressMonitor |
monitor
The IProgressMonitor to report the progress of a newsfeed
retrieval operation to.
|
(package private) static int |
POLL_EVENT
|
(package private) static int |
RETRIEVE_EVENT
|
(package private) static int |
UNCHANGED_EVENT
|
| Fields inherited from class com.sun.syndication.fetcher.impl.AbstractFeedFetcher |
|
| 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 feedCache)
Constructor to enable HttpURLFeedFetcher to cache feeds |
|
HttpURLFeedFetcher(FeedFetcherCache feedCache,
IProgressMonitor monitor)
Constructor to enable HttpURLFeedFetcher to cache feeds and to report the progress of a newsfeed retrieval operation to the specified IProgressMonitor.
|
|
| Method Summary | |
FeedFetcherCache |
getFeedInfoCache()
|
IProgressMonitor |
getProgressMonitor()
Gets the IProgressMonitor used by this
HttpURLFeedFetcher to report the progress of a newsfeed
retrieval operation.
|
private SyndFeed |
getSyndFeedFromStream(InputStream inputStream,
URLConnection connection)
|
protected void |
resetFeedInfo(URL orignalUrl,
SyndFeedInfo syndFeedInfo,
HttpURLConnection connection)
|
protected void |
retrieveAndCacheFeed(URL feedUrl,
SyndFeedInfo syndFeedInfo,
HttpURLConnection connection)
|
SyndFeed |
retrieveFeed(URL feedUrl)
Retrieve a feed over HTTP |
void |
setFeedInfoCache(FeedFetcherCache cache)
|
void |
setProgressMonitor(IProgressMonitor monitor)
Sets the IProgressMonitor to be used by this
HttpURLFeedFetcher to report the progress of a newsfeed
retrieval operation.
|
protected void |
setRequestHeaders(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, isUsingDeltaEncoding, removeFetcherEventListener, setUserAgent, setUsingDeltaEncoding, throw4XXError, throwAuthenticationError |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
static final int POLL_EVENT
static final int RETRIEVE_EVENT
static final int UNCHANGED_EVENT
private FeedFetcherCache feedInfoCache
private IProgressMonitor monitor
IProgressMonitor to report the progress of a newsfeed
retrieval operation to.
Added by Sebastian Machhausen (Sebastian.Machhausen@gmail.com)
| Constructor Detail |
public HttpURLFeedFetcher()
public HttpURLFeedFetcher(FeedFetcherCache feedCache)
feedCache - - an instance of the FeedFetcherCache interface
public HttpURLFeedFetcher(FeedFetcherCache feedCache,
IProgressMonitor monitor)
Constructor to enable HttpURLFeedFetcher to cache feeds and to report the
progress of a newsfeed retrieval operation to the specified
IProgressMonitor.
feedCache - an instance of the FeedFetcherCache
interfacemonitor - the IProgressMonitor used by this
HttpURLFeedFetcher to report the progress of a newsfeed
retrieval operation| Method Detail |
public SyndFeed retrieveFeed(URL feedUrl)
throws IllegalArgumentException,
IOException,
FeedException,
FetcherException
feedUrl - A non-null URL of a RSS/Atom feed to retrieve
SyndFeed object
IllegalArgumentException - if the URL is null;
IOException - if a TCP error occurs
FeedException - if the feed is not valid
FetcherException - if a HTTP error occurred
protected void retrieveAndCacheFeed(URL feedUrl,
SyndFeedInfo syndFeedInfo,
HttpURLConnection connection)
throws IllegalArgumentException,
FeedException,
FetcherException,
IOException
IllegalArgumentException
FeedException
FetcherException
IOException
protected void resetFeedInfo(URL orignalUrl,
SyndFeedInfo syndFeedInfo,
HttpURLConnection connection)
throws IllegalArgumentException,
IOException,
FeedException
IllegalArgumentException
IOException
FeedException
protected void setRequestHeaders(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 null
private SyndFeed getSyndFeedFromStream(InputStream inputStream,
URLConnection connection)
throws IOException,
IllegalArgumentException,
FeedException
IOException
IllegalArgumentException
FeedExceptionpublic FeedFetcherCache getFeedInfoCache()
public void setFeedInfoCache(FeedFetcherCache cache)
cache - The cache to be used by this fetcher (pass null to stop using a cache)public void setProgressMonitor(IProgressMonitor monitor)
Sets the IProgressMonitor to be used by this
HttpURLFeedFetcher to report the progress of a newsfeed
retrieval operation.
monitor - the IProgressMonitor to be used by this
HttpURLFeedFetcher to report the progress of a newsfeed
retrieval operationpublic IProgressMonitor getProgressMonitor()
Gets the IProgressMonitor used by this
HttpURLFeedFetcher to report the progress of a newsfeed
retrieval operation.
IProgressMonitor used by this
HttpURLFeedFetcher to report the progress of a newsfeed
retrieval operation
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||