private SyndFeed getFeed(final SyndFeedInfo syndFeedInfo, final String urlStr, final HttpMethod method, final int statusCode) throws IOException, HttpException, FetcherException, FeedException { if (statusCode == HttpURLConnection.HTTP_NOT_MODIFIED && syndFeedInfo != null) { fireEvent(FetcherEvent.EVENT_TYPE_FEED_UNCHANGED, urlStr); return syndFeedInfo.getSyndFeed(); } final SyndFeed feed = retrieveFeed(urlStr, method); fireEvent(FetcherEvent.EVENT_TYPE_FEED_RETRIEVED, urlStr, feed); return feed; }
/** * @return timeout the read timeout for the URLConnection to a specified timeout, in * milliseconds. */ public int getReadTimeout() { return getHttpClientParams().getSoTimeout(); }
@Override public SyndFeed retrieveFeed(final URL url) throws IllegalArgumentException, IOException, FeedException, FetcherException { return this.retrieveFeed(getUserAgent(), url); }
final FeedFetcherCache cache = getFeedInfoCache(); if (isUsingDeltaEncoding()) { method.setRequestHeader("A-IM", "feed"); fireEvent(FetcherEvent.EVENT_TYPE_FEED_POLLED, urlStr); handleErrorCodes(statusCode); SyndFeed feed = getFeed(syndFeedInfo, urlStr, method, statusCode); syndFeedInfo = buildSyndFeedInfo(feedUrl, urlStr, method, feed, statusCode); fireEvent(FetcherEvent.EVENT_TYPE_FEED_POLLED, urlStr); handleErrorCodes(statusCode); return getFeed(null, urlStr, method, statusCode);
if (imHeader != null && imHeader.getValue().contains("feed") && isUsingDeltaEncoding()) { final FeedFetcherCache cache = getFeedInfoCache(); feed = combineFeeds(cachedFeed, feed);
private SyndFeed retrieveFeed(final String urlStr, final HttpMethod method) throws IOException, HttpException, FetcherException, FeedException { final Header contentEncodingHeader = method.getResponseHeader("Content-Encoding"); final InputStream stream; if (contentEncodingHeader != null && "gzip".equalsIgnoreCase(contentEncodingHeader.getValue())) { stream = new GZIPInputStream(method.getResponseBodyAsStream()); } else { stream = method.getResponseBodyAsStream(); } try { final Header contentTypeHeader = method.getResponseHeader("Content-Type"); final XmlReader reader; if (contentTypeHeader != null) { reader = new XmlReader(stream, contentTypeHeader.getValue(), true); } else { reader = new XmlReader(stream, true); } final SyndFeedInput syndFeedInput = new SyndFeedInput(); syndFeedInput.setPreserveWireFeed(isPreserveWireFeed()); syndFeedInput.setAllowDoctypes(isAllowDoctypes()); return syndFeedInput.build(reader); } finally { IO.close(stream); } }
/** * @return The currently used connect timeout for the HttpClient but using the URLConnection * method name. Uses the HttpClientParams method getConnectionManagerTimeout instead of * getConnectTimeout * */ public int getConnectTimeout() { return (int) getHttpClientParams().getConnectionManagerTimeout(); }