Package com.sun.syndication.fetcher

Examples of com.sun.syndication.fetcher.FeedFetcher


        if(feedURL == null) {
            throw new IllegalArgumentException("feed url cannot be null");
        }
       
        // setup Rome feed fetcher
        FeedFetcher feedFetcher = getRomeFetcher();
       
        // fetch the feed
        log.debug("Fetching feed: "+feedURL);
        SyndFeed feed;
        try {
            feed = feedFetcher.retrieveFeed(new URL(feedURL));
        } catch (Exception ex) {
            throw new FetcherException("Error fetching subscription - "+feedURL, ex);
        }
       
        log.debug("Feed pulled, extracting data into Subscription");
View Full Code Here


    // get a feed fetcher
    private FeedFetcher getRomeFetcher() {
       
        FeedFetcherCache feedCache = getRomeFetcherCache();
       
        FeedFetcher feedFetcher = null;
        if(feedCache != null) {
            feedFetcher = new HttpURLFeedFetcher(feedCache);
        } else {
            feedFetcher = new HttpURLFeedFetcher();
        }
       
        // set options
        feedFetcher.setUsingDeltaEncoding(false);
        feedFetcher.setUserAgent("RollerPlanetAggregator");
       
        return feedFetcher;
    }
View Full Code Here

        }
        /** a hack to set 15 sec timeouts for java.net.HttpURLConnection */
        System.setProperty("sun.net.client.defaultConnectTimeout", "15000");
        System.setProperty("sun.net.client.defaultReadTimeout", "15000");
       
        FeedFetcher feedFetcher = new HttpURLFeedFetcher(feedInfoCache);
        //FeedFetcher feedFetcher = new HttpClientFeedFetcher(feedInfoCache);
        feedFetcher.setUsingDeltaEncoding(false);
        feedFetcher.setUserAgent("RollerPlanetAggregator");
       
        // Loop through all subscriptions in the system
        Iterator subs = getAllSubscriptions();
        while (subs.hasNext()) {
           
View Full Code Here

        try {
            URL feedUrl = new URL("http://www.oksnevad.org/tmp/nyheter.xml");

            FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getInstance();
//            FeedFetcherCache feedInfoCache = new DiskFeedInfoCache("/srv/torrcast_test");
            FeedFetcher fetcher = new HttpURLFeedFetcher(feedInfoCache);

//            FetcherEventListenerImpl listener = new FetcherEventListenerImpl();
            PodcastListener listener = new PodcastListener();
            fetcher.addFetcherEventListener(listener);

            System.err.println("Retrieving feed " + feedUrl);
            // Retrieve the feed.
            // We will get a Feed Polled Event and then a
            // Feed Retrieved event (assuming the feed is valid)
            SyndFeed feed = fetcher.retrieveFeed(feedUrl);

            System.err.println(feedUrl + " retrieved");
            System.err.println(feedUrl + " has a title: " + feed.getTitle() + " and contains "
                    + feed.getEntries().size() + " entries.");
            // We will now retrieve the feed again. If the feed is unmodified
            // and the server supports conditional gets, we will get a "Feed
            // Unchanged" event after the Feed Polled event
            System.err.println("Polling " + feedUrl + " again to test conditional get support.");
            SyndFeed feed2 = fetcher.retrieveFeed(feedUrl);
            System.err.println("If a \"Feed Unchanged\" event fired then the server supports conditional gets.");

            ok = true;
        } catch (Exception ex) {
            System.out.println("ERROR: " + ex.getMessage());
View Full Code Here

        if(feedURL == null) {
            throw new IllegalArgumentException("feed url cannot be null");
        }
       
        // setup Rome feed fetcher
        FeedFetcher feedFetcher = getRomeFetcher();
       
        // fetch the feed
        log.debug("Fetching feed: "+feedURL);
        SyndFeed feed;
        try {
            feed = feedFetcher.retrieveFeed(new URL(feedURL));
        } catch (Exception ex) {
            throw new FetcherException("Error fetching subscription - "+feedURL, ex);
        }
       
        log.debug("Feed pulled, extracting data into Subscription");
View Full Code Here

    // get a feed fetcher
    private FeedFetcher getRomeFetcher() {
       
        FeedFetcherCache feedCache = getRomeFetcherCache();
       
        FeedFetcher feedFetcher = null;
        if(feedCache != null) {
            feedFetcher = new HttpURLFeedFetcher(feedCache);
        } else {
            feedFetcher = new HttpURLFeedFetcher();
        }
       
        // set options
        feedFetcher.setUsingDeltaEncoding(false);
        feedFetcher.setUserAgent("RollerPlanetAggregator");
       
        return feedFetcher;
    }
View Full Code Here

        } catch (FeedException e) {
            logger.error("Error retrieving RSS feed from URL: " + url + ". Cause: " + e.getMessage(), e);
        } catch (IOException e) {
            // another way to load feed RSS
            final FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getInstance();
            final FeedFetcher fetcher = new HttpURLFeedFetcher(feedInfoCache);
            try {
                feed = fetcher.retrieveFeed(new URL(url));
            } catch (Exception e1) {
                logger.error("Error retrieving RSS feed from URL: " + url + ". Cause: " + e1.getMessage(), e1);
            }
        } catch (Exception e) {
            logger.error("Error retrieving RSS feed from URL: " + url + ". Cause: " + e.getMessage(), e);
View Full Code Here

     * @return
     * @throws Exception
     */
    private static SyndFeed fetch(String url) throws Exception
    {
        FeedFetcher fetcher = new HttpURLFeedFetcher();
        System.out.println("Retrieving: " + url);
        return fetcher.retrieveFeed(new URL(url));
    }
View Full Code Here

        PrevaylerDAOFactory factory = (PrevaylerDAOFactory) RomeDAOFactory.getDAOFactory(PrevaylerDAOFactory.class);
        PrevaylerSyndFeedDAO syndFeedDAO = (PrevaylerSyndFeedDAO) factory.getSyndFeedDAO();

        // Use Rome Fetcher to get a feed
        URL feedUrl = new URL(args[0]);
        FeedFetcher fetcher = new HttpURLFeedFetcher();
        System.out.println("Retrieving: " + args[0]);
        SyndFeed feed = fetcher.retrieveFeed(feedUrl);

        // For this example we'll use the URL as the UUID.  Check
        // to see if the UUID has already been used for persistence.
        // If not, we'll do an insert with it.  Otherwise, an update.
        String uuid = feedUrl.toString();
View Full Code Here

  /**
   * Test handling of GZipped feed
   *
   */
  public void testGZippedFeed() {
      FeedFetcher feedFetcher = getFeedFetcher();
    try {
      SyndFeed feed = feedFetcher.retrieveFeed(new URL("http://localhost:8080/rome/FetcherTestServlet?gzipfeed=TRUE"));
      assertNotNull(feed);
      assertEquals("atom_0.3.feed.title", feed.getTitle());
    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
View Full Code Here

TOP

Related Classes of com.sun.syndication.fetcher.FeedFetcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.