/** * Specify a flag to indication if {@code WireFeed} should be preserved in the target {@link SyndFeed}. * @param preserveWireFeed the {@code boolean} flag. * @since 5.0 * @see SyndFeedInput#setPreserveWireFeed(boolean) */ public void setPreserveWireFeed(boolean preserveWireFeed) { Assert.isTrue(!this.syndFeedInputSet, "'preserveWireFeed' must be configured on the provided [" + this.syndFeedInput + "]"); this.syndFeedInput.setPreserveWireFeed(preserveWireFeed); }
/** * Specify a flag to indication if {@code WireFeed} should be preserved in the target {@link SyndFeed}. * @param preserveWireFeed the {@code boolean} flag. * @since 5.0 * @see SyndFeedInput#setPreserveWireFeed(boolean) */ public void setPreserveWireFeed(boolean preserveWireFeed) { Assert.isTrue(!this.syndFeedInputSet, "'preserveWireFeed' must be configured on the provided [" + this.syndFeedInput + "]"); this.syndFeedInput.setPreserveWireFeed(preserveWireFeed); }
private SyndFeed readSyndFeedFromStream(InputStream inputStream, URLConnection connection) throws IOException, IllegalArgumentException, FeedException { BufferedInputStream is; if ("gzip".equalsIgnoreCase(connection.getContentEncoding())) { // handle gzip encoded content is = new BufferedInputStream(new GZIPInputStream(inputStream)); } else { is = new BufferedInputStream(inputStream); } XmlReader reader = null; if (connection.getHeaderField("Content-Type") != null) { reader = new XmlReader(is, connection.getHeaderField("Content-Type"), true); } else { reader = new XmlReader(is, true); } SyndFeedInput syndFeedInput = new SyndFeedInput(); syndFeedInput.setPreserveWireFeed(isPreserveWireFeed()); return syndFeedInput.build(reader); }
private SyndFeed readSyndFeedFromStream(final InputStream inputStream, final URLConnection connection) throws IOException, IllegalArgumentException, FeedException { BufferedInputStream is; if ("gzip".equalsIgnoreCase(connection.getContentEncoding())) { // handle gzip encoded content is = new BufferedInputStream(new GZIPInputStream(inputStream)); } else { is = new BufferedInputStream(inputStream); } final XmlReader reader; if (connection.getHeaderField("Content-Type") != null) { reader = new XmlReader(is, connection.getHeaderField("Content-Type"), true); } else { reader = new XmlReader(is, true); } final SyndFeedInput syndFeedInput = new SyndFeedInput(); syndFeedInput.setPreserveWireFeed(isPreserveWireFeed()); syndFeedInput.setAllowDoctypes(isAllowDoctypes()); return syndFeedInput.build(reader); }
private SyndFeed readFeedFromStream(InputStream inputStream, URLConnection connection) throws IOException, FeedException { BufferedInputStream bufferedInputStream; if ("gzip".equalsIgnoreCase(connection.getContentEncoding())) { // handle gzip encoded content bufferedInputStream = new BufferedInputStream(new GZIPInputStream(inputStream)); } else { bufferedInputStream = new BufferedInputStream(inputStream); } XmlReader reader = null; if (connection.getHeaderField("Content-Type") != null) { reader = new XmlReader(bufferedInputStream, connection.getHeaderField("Content-Type"), true); } else { reader = new XmlReader(bufferedInputStream, true); } SyndFeedInput syndFeedInput = new SyndFeedInput(); syndFeedInput.setPreserveWireFeed(isPreserveWireFeed()); SyndFeed feed = syndFeedInput.build(reader); fireEvent(com.rometools.fetcher.FetcherEvent.EVENT_TYPE_FEED_RETRIEVED, connection, feed); return 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); } }