本文整理汇总了Java中com.rometools.rome.feed.rss.Channel.setPubDate方法的典型用法代码示例。如果您正苦于以下问题:Java Channel.setPubDate方法的具体用法?Java Channel.setPubDate怎么用?Java Channel.setPubDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rometools.rome.feed.rss.Channel
的用法示例。
在下文中一共展示了Channel.setPubDate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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));
}
}
示例2: createRealFeed
import com.rometools.rome.feed.rss.Channel; //导入方法依赖的package包/类
@Override
protected WireFeed createRealFeed(final String type, final SyndFeed syndFeed) {
final Channel channel = (Channel) super.createRealFeed(type, syndFeed);
channel.setLanguage(syndFeed.getLanguage()); // c
channel.setCopyright(syndFeed.getCopyright()); // c
channel.setPubDate(syndFeed.getPublishedDate()); // c
channel.setDocs(syndFeed.getDocs());
channel.setManagingEditor(syndFeed.getManagingEditor());
channel.setWebMaster(syndFeed.getWebMaster());
channel.setGenerator(syndFeed.getGenerator());
final List<SyndPerson> authors = syndFeed.getAuthors();
if (Lists.isNotEmpty(authors)) {
final SyndPerson author = authors.get(0);
channel.setManagingEditor(author.getName());
}
return channel;
}
示例3: 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()));
}