本文整理汇总了Java中com.rometools.rome.feed.rss.Channel.setDescription方法的典型用法代码示例。如果您正苦于以下问题:Java Channel.setDescription方法的具体用法?Java Channel.setDescription怎么用?Java Channel.setDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rometools.rome.feed.rss.Channel
的用法示例。
在下文中一共展示了Channel.setDescription方法的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());
}
示例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));
}
}
示例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;
}
示例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);
}
示例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));
}
示例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;
}
示例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;
}
示例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");
}
示例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()));
}
示例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"));
}
示例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;
}