@Deprecated public class HttpURLFeedFetcher extends AbstractFeedFetcher
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);
Modifier and Type | Field and Description |
---|---|
private int |
connectTimeout
Deprecated.
|
private FeedFetcherCache |
feedInfoCache
Deprecated.
|
(package private) static int |
POLL_EVENT
Deprecated.
|
(package private) static int |
RETRIEVE_EVENT
Deprecated.
|
(package private) static int |
UNCHANGED_EVENT
Deprecated.
|
DEFAULT_USER_AGENT
Constructor and Description |
---|
HttpURLFeedFetcher()
Deprecated.
Constructor to use HttpURLFeedFetcher without caching of feeds
|
HttpURLFeedFetcher(FeedFetcherCache feedInfoCache)
Deprecated.
Constructor to enable HttpURLFeedFetcher to cache feeds
|
Modifier and Type | Method and Description |
---|---|
FeedFetcherCache |
getFeedInfoCache()
Deprecated.
|
private SyndFeed |
getSyndFeedFromStream(java.io.InputStream inputStream,
java.net.URLConnection connection)
Deprecated.
|
private SyndFeed |
readSyndFeedFromStream(java.io.InputStream inputStream,
java.net.URLConnection connection)
Deprecated.
|
protected void |
resetFeedInfo(java.net.URL orignalUrl,
SyndFeedInfo syndFeedInfo,
java.net.HttpURLConnection connection)
Deprecated.
|
protected void |
retrieveAndCacheFeed(java.net.URL feedUrl,
SyndFeedInfo syndFeedInfo,
java.net.HttpURLConnection connection)
Deprecated.
|
SyndFeed |
retrieveFeed(java.lang.String userAgent,
java.net.URL feedUrl)
Deprecated.
Retrieve a feed over HTTP
|
SyndFeed |
retrieveFeed(java.net.URL feedUrl)
Deprecated.
Retrieve a feed over HTTP
|
void |
setConnectTimeout(int timeout)
Deprecated.
|
void |
setFeedInfoCache(FeedFetcherCache cache)
Deprecated.
|
protected void |
setRequestHeaders(java.net.URLConnection connection,
SyndFeedInfo syndFeedInfo,
java.lang.String userAgent)
Deprecated.
Set appropriate HTTP headers, including conditional get and gzip encoding headers
|
addFetcherEventListener, combineFeeds, fireEvent, fireEvent, fireEvent, fireEvent, getUserAgent, handleErrorCodes, isAllowDoctypes, isPreserveWireFeed, isUsingDeltaEncoding, removeFetcherEventListener, setAllowDoctypes, setPreserveWireFeed, setUserAgent, setUsingDeltaEncoding, throw4XXError, throwAuthenticationError
private volatile int connectTimeout
static final int POLL_EVENT
static final int RETRIEVE_EVENT
static final int UNCHANGED_EVENT
private FeedFetcherCache feedInfoCache
public HttpURLFeedFetcher()
public HttpURLFeedFetcher(FeedFetcherCache feedInfoCache)
feedInfoCache
- - an instance of the FeedFetcherCache interfacepublic SyndFeed retrieveFeed(java.net.URL feedUrl) throws java.lang.IllegalArgumentException, java.io.IOException, FeedException, FetcherException
FeedFetcher
feedUrl
- A non-null URL of a RSS/Atom feed to retrieveSyndFeed
objectjava.lang.IllegalArgumentException
- if the URL is null;java.io.IOException
- if a TCP error occursFeedException
- if the feed is not validFetcherException
- if a HTTP error occurredpublic SyndFeed retrieveFeed(java.lang.String userAgent, java.net.URL feedUrl) throws java.lang.IllegalArgumentException, java.io.IOException, FeedException, FetcherException
feedUrl
- A non-null URL of a RSS/Atom feed to retrieveSyndFeed
objectjava.lang.IllegalArgumentException
- if the URL is null;java.io.IOException
- if a TCP error occursFeedException
- if the feed is not validFetcherException
- if a HTTP error occurredprotected void retrieveAndCacheFeed(java.net.URL feedUrl, SyndFeedInfo syndFeedInfo, java.net.HttpURLConnection connection) throws java.lang.IllegalArgumentException, FeedException, FetcherException, java.io.IOException
java.lang.IllegalArgumentException
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, FeedException
java.lang.IllegalArgumentException
java.io.IOException
FeedException
protected void setRequestHeaders(java.net.URLConnection connection, SyndFeedInfo syndFeedInfo, java.lang.String userAgent)
Set appropriate HTTP headers, including conditional get and gzip encoding headers
connection
- A URLConnectionsyndFeedInfo
- The SyndFeedInfo for the feed to be retrieved. May be nulluserAgent
- the name of the user-agent to be placed in HTTP-header.private SyndFeed readSyndFeedFromStream(java.io.InputStream inputStream, java.net.URLConnection connection) throws java.io.IOException, java.lang.IllegalArgumentException, FeedException
java.io.IOException
java.lang.IllegalArgumentException
FeedException
private SyndFeed getSyndFeedFromStream(java.io.InputStream inputStream, java.net.URLConnection connection) throws java.io.IOException, java.lang.IllegalArgumentException, FeedException
java.io.IOException
java.lang.IllegalArgumentException
FeedException
public 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 setConnectTimeout(int timeout)
timeout
- see java.net.URLConnection.setConnectTimeout(int timeout)