当前位置: 首页>>代码示例>>Java>>正文


Java Channel.setLink方法代码示例

本文整理汇总了Java中com.rometools.rome.feed.rss.Channel.setLink方法的典型用法代码示例。如果您正苦于以下问题:Java Channel.setLink方法的具体用法?Java Channel.setLink怎么用?Java Channel.setLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.rometools.rome.feed.rss.Channel的用法示例。


在下文中一共展示了Channel.setLink方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeOtherCharset

import com.rometools.rome.feed.rss.Channel; //导入方法依赖的package包/类
@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();
	converter.write(channel, null, outputMessage);

	assertEquals("Invalid content-type", new MediaType("application", "rss+xml", Charset.forName(encoding)),
			outputMessage.getHeaders().getContentType());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:20,代码来源:RssChannelHttpMessageConverterTests.java

示例2: buildFeedMetadata

import com.rometools.rome.feed.rss.Channel; //导入方法依赖的package包/类
@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));
  }
}
 
开发者ID:kaif-open,项目名称:kaif,代码行数:20,代码来源:HotArticleRssContentView.java

示例3: newFeed

import com.rometools.rome.feed.rss.Channel; //导入方法依赖的package包/类
@Override
protected Channel newFeed() {
    Channel channel = new Channel("rss_2.0");
    channel.setLink(applicationSettings.getBaseUrl() + "/posts/feed/");
    channel.setTitle(applicationSettings.getRssChannelTitle());
    channel.setDescription(applicationSettings.getRssChannelDescription());
    postService.getOneMostRecent()
            .ifPresent(p -> channel.setPubDate(Date.from(p.getPostDate().toInstant())));
    return channel;
}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:11,代码来源:RssPostFeedView.java

示例4: buildFeedMetadata

import com.rometools.rome.feed.rss.Channel; //导入方法依赖的package包/类
@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);
}
 
开发者ID:PacktPublishing,项目名称:Spring-MVC-Blueprints,代码行数:11,代码来源:HrmsRssViewBuilder.java

示例5: write

import com.rometools.rome.feed.rss.Channel; //导入方法依赖的package包/类
@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));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:31,代码来源:RssChannelHttpMessageConverterTests.java

示例6: newFeed

import com.rometools.rome.feed.rss.Channel; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:JakduK,项目名称:jakduk-api,代码行数:13,代码来源:DocumentRssFeedView.java

示例7: createRealFeed

import com.rometools.rome.feed.rss.Channel; //导入方法依赖的package包/类
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;
}
 
开发者ID:rometools,项目名称:rome,代码行数:35,代码来源:ConverterForRSS090.java

示例8: buildFeedMetadata

import com.rometools.rome.feed.rss.Channel; //导入方法依赖的package包/类
@Override
protected void buildFeedMetadata(Map model, Channel channel, HttpServletRequest request) {
	channel.setTitle("Test Feed");
	channel.setDescription("Test feed description");
	channel.setLink("http://example.com");
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:7,代码来源:RssFeedViewTests.java

示例9: buildFeedMetadata

import com.rometools.rome.feed.rss.Channel; //导入方法依赖的package包/类
@Override
protected void buildFeedMetadata(final Map<String, Object> model, final Channel feed, final HttpServletRequest request) {
    final Page<Post> posts = (Page<Post>) model.get("posts");

    final Locale locale = request.getLocale();
    feed.setEncoding("UTF-8");
    feed.setTitle(String.format("%s - %s", messageSource.getMessage("siteTitle", null, locale), messageSource.getMessage("siteSubTitle", null, locale)));
    feed.setDescription(messageSource.getMessage("feedDescription", null, locale));
    feed.setLink(getAbsoluteUrl(request, ""));
    if (posts.hasContent()) {
        final Date pubDate = Date.from(posts.getContent().get(0).getPublishedOn().atStartOfDay(UTC).toInstant());
        feed.setLastBuildDate(pubDate);
        feed.setPubDate(pubDate);
    }
    feed.setGenerator("https://github.com/EuregJUG-Maas-Rhine/site");

    final String hrefFormat = "%s?page=%d";
    final String self = getAbsoluteUrl(request, "/feed.rss");
    final List<Link> atomLinks = new ArrayList<>();
    atomLinks.add(new SyndicationLink().withRel("self").withType(super.getContentType()).withHref(String.format(hrefFormat, self, posts.getNumber())).getLink());
    if (posts.hasPrevious()) {
        atomLinks.add(new SyndicationLink()
                .withRel("previous")
                .withType(super.getContentType())
                .withHref(String.format(hrefFormat, self, posts.previousPageable().getPageNumber()))
                .getLink()
        );
    }
    if (posts.hasNext()) {
        atomLinks.add(new SyndicationLink()
                .withRel("next")
                .withType(super.getContentType())
                .withHref(String.format(hrefFormat, self, posts.nextPageable().getPageNumber()))
                .getLink()
        );
    }
    feed.getModules().addAll(atomLinks.stream().map(l -> {
        final AtomLinkModuleImpl rv = new AtomLinkModuleImpl();
        rv.setLink(l);
        return rv;
    }).collect(Collectors.toList()));
}
 
开发者ID:EuregJUG-Maas-Rhine,项目名称:site,代码行数:43,代码来源:IndexRssView.java

示例10: buildFeedMetadata

import com.rometools.rome.feed.rss.Channel; //导入方法依赖的package包/类
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"));
}
 
开发者ID:PodcastpediaOrg,项目名称:podcastpedia-web,代码行数:6,代码来源:FoundEpisodesRssFeedView.java

示例11: parseChannel

import com.rometools.rome.feed.rss.Channel; //导入方法依赖的package包/类
/**
 * 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;

}
 
开发者ID:rometools,项目名称:rome,代码行数:65,代码来源:RSS090Parser.java


注:本文中的com.rometools.rome.feed.rss.Channel.setLink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。