Java Code Examples for com.rometools.rome.feed.rss.Channel#setLink()
The following examples show how to use
com.rometools.rome.feed.rss.Channel#setLink() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RssChannelHttpMessageConverterTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void writeOtherCharset() throws IOException, SAXException { Channel channel = new Channel("rss_2.0"); channel.setTitle("title"); channel.setLink("https://example.com"); channel.setDescription("description"); String encoding = "ISO-8859-1"; channel.setEncoding(encoding); Item item1 = new Item(); item1.setTitle("title1"); MockHttpOutputMessage outputMessage = new MockHttpOutputMessage(); converter.write(channel, null, outputMessage); assertEquals("Invalid content-type", new MediaType("application", "rss+xml", Charset.forName(encoding)), outputMessage.getHeaders().getContentType()); }
Example 2
Source File: HotArticleRssContentView.java From kaif with Apache License 2.0 | 6 votes |
@Override protected void buildFeedMetadata(Map<String, Object> model, Channel feed, HttpServletRequest request) { ZoneInfo zoneInfo = (ZoneInfo) model.get("zoneInfo"); @SuppressWarnings("unchecked") List<Article> articles = (List<Article>) model.get("articles"); if (zoneInfo != null) { feed.setTitle(zoneInfo.getName() + " kaif.io"); feed.setLink(zoneUrl(zoneInfo.getZone())); feed.setDescription(zoneInfo.getAliasName() + " 熱門"); feed.setPubDate(buildFeedUpdateTime(articles, zoneInfo.getCreateTime())); } else { feed.setTitle("熱門 kaif.io"); feed.setLink(SCHEME_AND_HOST); feed.setDescription("綜合熱門"); feed.setPubDate(buildFeedUpdateTime(articles, DEFAULT_INSTANT)); } }
Example 3
Source File: ArticleRssController.java From tutorials with MIT License | 6 votes |
private Channel buildChannel(List<Article> articles){ Channel channel = new Channel("rss_2.0"); channel.setLink("http://localhost:8080/spring-mvc-simple/rss"); channel.setTitle("Article Feed"); channel.setDescription("Article Feed Description"); channel.setPubDate(new Date()); List<Item> items = new ArrayList<>(); for (Article article : articles) { Item item = new Item(); item.setLink(article.getLink()); item.setTitle(article.getTitle()); Description description1 = new Description(); description1.setValue(article.getDescription()); item.setDescription(description1); item.setPubDate(article.getPublishedDate()); item.setAuthor(article.getAuthor()); items.add(item); } channel.setItems(items); return channel; }
Example 4
Source File: ArticleFeedView.java From tutorials with MIT License | 5 votes |
protected Channel newFeed() { Channel channel = new Channel("rss_2.0"); channel.setLink("http://localhost:8080/spring-mvc-simple/rss"); channel.setTitle("Article Feed"); channel.setDescription("Article Feed Description"); channel.setPubDate(new Date()); return channel; }
Example 5
Source File: ConverterForRSS090.java From rome with Apache License 2.0 | 5 votes |
protected WireFeed createRealFeed(final String type, final SyndFeed syndFeed) { final Channel channel = new Channel(type); channel.setModules(ModuleUtils.cloneModules(syndFeed.getModules())); channel.setStyleSheet(syndFeed.getStyleSheet()); channel.setEncoding(syndFeed.getEncoding()); channel.setTitle(syndFeed.getTitle()); final String link = syndFeed.getLink(); final List<SyndLink> links = syndFeed.getLinks(); if (link != null) { channel.setLink(link); } else if (!links.isEmpty()) { channel.setLink(links.get(0).getHref()); } channel.setDescription(syndFeed.getDescription()); final SyndImage sImage = syndFeed.getImage(); if (sImage != null) { channel.setImage(createRSSImage(sImage)); } final List<SyndEntry> sEntries = syndFeed.getEntries(); if (sEntries != null) { channel.setItems(createRSSItems(sEntries)); } final List<Element> foreignMarkup = syndFeed.getForeignMarkup(); if (!foreignMarkup.isEmpty()) { channel.setForeignMarkup(foreignMarkup); } return channel; }
Example 6
Source File: DocumentRssFeedView.java From jakduk-api with MIT License | 5 votes |
/** * 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() { Channel channel = new Channel("rss_2.0"); channel.setLink(String.format("%s/%s", jakdukProperties.getWebServerUrl(), "/rss")); channel.setTitle(JakdukUtils.getMessageSource("common.jakduk")); channel.setDescription(JakdukUtils.getMessageSource("common.jakduk.rss.description")); return channel; }
Example 7
Source File: BasicPodfeedService.java From sakai with Educational Community License v2.0 | 5 votes |
/** * This puts the pieces together to generate the actual feed. * * @param title * The global title for the podcast * @param link * The URL for the feed * @param description_loc * Global description of the feed * @param copyright * Copyright information * @param entries * The list of individual podcasts * @param feedTyle * The output feed type (for potential future development). Set to rss_2.0 * @param pubDate * The date to set the publish date for this feed * * @eturn SyndFeed * The entire podcast stuffed into a SyndFeed object */ private Channel doSyndication(Map feedInfo, List entries, String feedType, Date pubDate, Date lastBuildDate) { final Channel channel = new Channel(); // FUTURE: How to determine what podcatcher supports and feed that to them channel.setFeedType(feedType); channel.setTitle((String) feedInfo.get("title")); channel.setLanguage(LANGUAGE); channel.setPubDate(pubDate); channel.setLastBuildDate(lastBuildDate); channel.setLink((String) feedInfo.get("url")); channel.setDescription((String) feedInfo.get("desc")); channel.setCopyright((String) feedInfo.get("copyright")); channel.setGenerator((String) feedInfo.get("gen")); channel.setItems(entries); // Used to remove the dc: tags from the channel level info List modules = new ArrayList(); channel.setModules(modules); return channel; }
Example 8
Source File: RssFeedView.java From wallride with Apache License 2.0 | 5 votes |
@Override protected void buildFeedMetadata( Map<String, Object> model, Channel feed, HttpServletRequest request) { Blog blog = blogService.getBlogById(Blog.DEFAULT_ID); String language = LocaleContextHolder.getLocale().getLanguage(); feed.setTitle(blog.getTitle(language)); feed.setDescription(blog.getTitle(language)); UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath(); feed.setLink(builder.buildAndExpand().toUriString()); }
Example 9
Source File: ArticleFeedView.java From tutorials with MIT License | 5 votes |
protected Channel newFeed() { Channel channel = new Channel("rss_2.0"); channel.setLink("http://localhost:8080/rss"); channel.setTitle("Article Feed"); channel.setDescription("Article Feed Description"); channel.setPubDate(new Date()); return channel; }
Example 10
Source File: RssChannelHttpMessageConverterTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@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), outputMessage.getHeaders().getContentType()); String expected = "<rss version=\"2.0\">" + "<channel><title>title</title><link>http://example.com</link><description>description</description>" + "<item><title>title1</title></item>" + "<item><title>title2</title></item>" + "</channel></rss>"; assertXMLEqual(expected, outputMessage.getBodyAsString(utf8)); }
Example 11
Source File: HrmsRssViewBuilder.java From Spring-MVC-Blueprints with MIT License | 5 votes |
@Override protected void buildFeedMetadata(Map<String, Object> model, Channel feed, HttpServletRequest request) { feed.setTitle("HRMS News Feeds"); feed.setDescription("Packt Publishing's Spring MVC Blueprint"); feed.setLink("https://www.packtpub.com/"); super.buildFeedMetadata(model, feed, request); }
Example 12
Source File: RssChannelHttpMessageConverterTests.java From java-technology-stack with MIT License | 5 votes |
@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<>(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", StandardCharsets.UTF_8), outputMessage.getHeaders().getContentType()); String expected = "<rss version=\"2.0\">" + "<channel><title>title</title><link>http://example.com</link><description>description</description>" + "<item><title>title1</title></item>" + "<item><title>title2</title></item>" + "</channel></rss>"; assertThat(outputMessage.getBodyAsString(StandardCharsets.UTF_8), isSimilarTo(expected)); }
Example 13
Source File: RssChannelHttpMessageConverterTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void write() throws IOException, SAXException { Channel channel = new Channel("rss_2.0"); channel.setTitle("title"); channel.setLink("https://example.com"); channel.setDescription("description"); Item item1 = new Item(); item1.setTitle("title1"); Item item2 = new Item(); item2.setTitle("title2"); List<Item> items = new ArrayList<>(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", StandardCharsets.UTF_8), outputMessage.getHeaders().getContentType()); String expected = "<rss version=\"2.0\">" + "<channel><title>title</title><link>https://example.com</link><description>description</description>" + "<item><title>title1</title></item>" + "<item><title>title2</title></item>" + "</channel></rss>"; assertThat(outputMessage.getBodyAsString(StandardCharsets.UTF_8), isSimilarTo(expected)); }
Example 14
Source File: RssFeedViewTests.java From spring-analysis-note with MIT License | 4 votes |
@Override protected void buildFeedMetadata(Map<String, Object> model, Channel channel, HttpServletRequest request) { channel.setTitle("Test Feed"); channel.setDescription("Test feed description"); channel.setLink("https://example.com"); }
Example 15
Source File: RssFeedViewTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override protected void buildFeedMetadata(Map model, Channel channel, HttpServletRequest request) { channel.setTitle("Test Feed"); channel.setDescription("Test feed description"); channel.setLink("http://example.com"); }
Example 16
Source File: FoundEpisodesRssFeedView.java From podcastpedia-web with MIT License | 4 votes |
protected void buildFeedMetadata(Map model, Channel feed, HttpServletRequest request) { feed.setTitle("" + model.get("feed_title")); feed.setDescription(" " + model.get("feed_description")); feed.setLink("" + model.get("feed_link")); }
Example 17
Source File: GenericRssFeedView.java From podcastpedia-web with MIT License | 4 votes |
protected void buildFeedMetadata(Map model, Channel feed, HttpServletRequest request) { feed.setTitle("" + model.get("feed_title")); feed.setDescription(" " + model.get("feed_description")); feed.setLink("" + model.get("feed_link")); }
Example 18
Source File: FoundPodcastsRssFeedView.java From podcastpedia-web with MIT License | 4 votes |
protected void buildFeedMetadata(Map model, Channel feed, HttpServletRequest request) { feed.setTitle("" + model.get("feed_title")); feed.setDescription(" " + model.get("feed_description")); feed.setLink("" + model.get("feed_link")); }
Example 19
Source File: RSS090Parser.java From rome with Apache License 2.0 | 4 votes |
/** * Parses the root element of an RSS document into a Channel bean. * <p/> * It reads title, link and description and delegates to parseImage, parseItems and * parseTextInput. This delegation always passes the root element of the RSS document as * different RSS version may have this information in different parts of the XML tree (no * assumptions made thanks to the specs variaty) * <p/> * * @param rssRoot the root element of the RSS document to parse. * @return the parsed Channel bean. */ protected WireFeed parseChannel(final Element rssRoot, final Locale locale) { final Channel channel = new Channel(getType()); channel.setStyleSheet(getStyleSheet(rssRoot.getDocument())); final Element eChannel = rssRoot.getChild("channel", getRSSNamespace()); final Element title = eChannel.getChild("title", getRSSNamespace()); if (title != null) { channel.setTitle(title.getText()); } final Element link = eChannel.getChild("link", getRSSNamespace()); if (link != null) { channel.setLink(link.getText()); } final Element description = eChannel.getChild("description", getRSSNamespace()); if (description != null) { channel.setDescription(description.getText()); } channel.setImage(parseImage(rssRoot)); channel.setTextInput(parseTextInput(rssRoot)); // Unfortunately Microsoft's SSE extension has a special case of effectively putting the // sharing channel module inside the RSS tag and not inside the channel itself. So we also // need to look for channel modules from the root RSS element. final List<Module> allFeedModules = new ArrayList<Module>(); final List<Module> rootModules = parseFeedModules(rssRoot, locale); final List<Module> channelModules = parseFeedModules(eChannel, locale); if (rootModules != null) { allFeedModules.addAll(rootModules); } if (channelModules != null) { allFeedModules.addAll(channelModules); } channel.setModules(allFeedModules); channel.setItems(parseItems(rssRoot, locale)); final List<Element> foreignMarkup = extractForeignMarkup(eChannel, channel, getRSSNamespace()); if (!foreignMarkup.isEmpty()) { channel.setForeignMarkup(foreignMarkup); } return channel; }
Example 20
Source File: RssFeedViewTests.java From java-technology-stack with MIT License | 4 votes |
@Override protected void buildFeedMetadata(Map<String, Object> model, Channel channel, HttpServletRequest request) { channel.setTitle("Test Feed"); channel.setDescription("Test feed description"); channel.setLink("http://example.com"); }