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


Java Channel.setPubDate方法代码示例

本文整理汇总了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));
  }
}
 
开发者ID:kaif-open,项目名称:kaif,代码行数:20,代码来源:HotArticleRssContentView.java

示例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;
}
 
开发者ID:rometools,项目名称:rome,代码行数:20,代码来源:ConverterForRSS091Userland.java

示例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()));
}
 
开发者ID:EuregJUG-Maas-Rhine,项目名称:site,代码行数:43,代码来源:IndexRssView.java


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