Package com.rometools.rome.feed.rss

Examples of com.rometools.rome.feed.rss.Channel


                        if (logger.isDebugEnabled()) logger.debug("Nothing new in the feed... Relaxing...");
                    }

                    // #8 : Use the ttl rss field to auto adjust feed refresh rate
                    if (!ignoreTtl && feed.originalWireFeed() != null && feed.originalWireFeed() instanceof Channel) {
                        Channel channel = (Channel) feed.originalWireFeed();
                        if (channel.getTtl() > 0) {
                            int minutes = channel.getTtl();
                            if (minutes != updateRate.minutes()) {
                                updateRate = TimeValue.timeValueMinutes(minutes);
                                if (logger.isInfoEnabled())
                                    logger.info("Auto adjusting update rate with provided ttl: {}", updateRate);
                            }
View Full Code Here


   * Create a new Channel instance to hold the entries.
   * <p>By default returns an RSS 2.0 channel, but the subclass can specify any channel.
   */
  @Override
  protected Channel newFeed() {
    return new Channel("rss_2.0");
  }
View Full Code Here

  @Test
  public void read() throws IOException {
    InputStream is = getClass().getResourceAsStream("rss.xml");
    MockHttpInputMessage inputMessage = new MockHttpInputMessage(is);
    inputMessage.getHeaders().setContentType(new MediaType("application", "rss+xml", utf8));
    Channel result = converter.read(Channel.class, inputMessage);
    assertEquals("title", result.getTitle());
    assertEquals("http://example.com", result.getLink());
    assertEquals("description", result.getDescription());

    List<?> items = result.getItems();
    assertEquals(2, items.size());

    Item item1 = (Item) items.get(0);
    assertEquals("title1", item1.getTitle());
View Full Code Here

    assertEquals("title2", item2.getTitle());
  }

  @Test
  public void write() throws IOException, SAXException {
    Channel channel = new Channel("rss_2.0");
    channel.setTitle("title");
    channel.setLink("http://example.com");
    channel.setDescription("description");

    Item item1 = new Item();
    item1.setTitle("title1");

    Item item2 = new Item();
    item2.setTitle("title2");

    List<Item> items = new ArrayList<Item>(2);
    items.add(item1);
    items.add(item2);
    channel.setItems(items);

    MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
    converter.write(channel, null, outputMessage);

    assertEquals("Invalid content-type", new MediaType("application", "rss+xml", utf8),
View Full Code Here

    assertXMLEqual(expected, outputMessage.getBodyAsString(utf8));
  }

  @Test
  public void writeOtherCharset() throws IOException, SAXException {
    Channel channel = new Channel("rss_2.0");
    channel.setTitle("title");
    channel.setLink("http://example.com");
    channel.setDescription("description");

    String encoding = "ISO-8859-1";
    channel.setEncoding(encoding);

    Item item1 = new Item();
    item1.setTitle("title1");

    MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
View Full Code Here

        assertThat(feed.getEntries().isEmpty(), equalTo(false));

        assertThat(feed.originalWireFeed(), notNullValue());
        assertThat(feed.originalWireFeed(), instanceOf(Channel.class));

        Channel channel = (Channel) feed.originalWireFeed();
        assertThat(channel.getTtl(), equalTo(15));
  }
View Full Code Here

    return "Read " + channel.getTitle();
  }

  @RequestMapping(value="/rss", method=RequestMethod.GET)
  public @ResponseBody Channel writeChannel() {
    Channel channel = new Channel();
    channel.setFeedType("rss_2.0");
    channel.setTitle("My RSS feed");
    channel.setDescription("Description");
    channel.setLink("http://localhost:8080/mvc-showcase/rss");
    return channel;
  }
View Full Code Here

    }

    @Override
    public void copyInto(final WireFeed feed, final SyndFeed syndFeed) {

        final Channel channel = (Channel) feed;

        super.copyInto(channel, syndFeed);

        final List<Category> cats = channel.getCategories(); // c
        if (!cats.isEmpty()) {

            // using a set to remove duplicates
            final Set<SyndCategory> s = new LinkedHashSet<SyndCategory>();
View Full Code Here

    }

    @Override
    protected WireFeed createRealFeed(final String type, final SyndFeed syndFeed) {
        final Channel channel = (Channel) super.createRealFeed(type, syndFeed);
        final List<SyndCategory> cats = syndFeed.getCategories(); // c
        if (!cats.isEmpty()) {
            channel.setCategories(createRSSCategories(cats));
        }
        return channel;
    }
View Full Code Here

    }

    @Override
    public void copyInto(final WireFeed feed, final SyndFeed syndFeed) {

        final Channel channel = (Channel) feed;

        super.copyInto(channel, syndFeed);

        final String uri = channel.getUri();
        if (uri != null) {
            syndFeed.setUri(uri);
        } else {
            // if URI is not set use the value for link
            final String link = channel.getLink();
            syndFeed.setUri(link);
        }
    }
View Full Code Here

TOP

Related Classes of com.rometools.rome.feed.rss.Channel

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.