• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Content类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Content类属于com.rometools.rome.feed.rss包,在下文中一共展示了Content类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: buildFeedItems

import com.rometools.rome.feed.rss.Content; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected List<Item> buildFeedItems(Map<String, Object> model,
		HttpServletRequest req, HttpServletResponse resp) throws Exception {
	
	// get data model which is passed by the Spring container
	List<HrmsNews> news = (List<HrmsNews>) model.get("allNews");
       List<Item> items = new ArrayList<Item>(news.size());
 	
	for(HrmsNews topic : news ){
	
		Item item = new Item();
		
		Content content = new Content();
		content.setValue(topic.getSummary());
		item.setContent(content);
		
		item.setTitle(topic.getDescription());
		item.setLink(topic.getLink());
		item.setPubDate(new Date());
		
		items.add(item);
	}
	
	return items;
}
 
开发者ID:PacktPublishing,项目名称:Spring-MVC-Blueprints,代码行数:27,代码来源:HrmsRssViewBuilder.java


示例2: buildFeedItems

import com.rometools.rome.feed.rss.Content; //导入依赖的package包/类
@Override
protected List<Item> buildFeedItems(final Map<String, Object> model, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
    final Page<Post> posts = (Page<Post>) model.get("posts");

    return posts.map(post -> {
        final Item rv = new Item();
        final Content content = new Content();
        content.setType(Content.HTML);
        content.setValue(post.getContent());
        final String link = getAbsoluteUrl(request, String.format("%s/%s", permalinkDateFormatter.format(post.getPublishedOn()), post.getSlug()));

        rv.setAuthor("euregjug.eu");
        rv.setContent(content);
        rv.setGuid(new SyndicationGuid().withPermaLink(true).withValue(link).getGuid());
        rv.setLink(link);
        rv.setPubDate(Date.from(post.getPublishedOn().atStartOfDay(UTC).toInstant()));
        rv.setTitle(post.getTitle());
        return rv;
    }).getContent();
}
 
开发者ID:EuregJUG-Maas-Rhine,项目名称:site,代码行数:21,代码来源:IndexRssView.java


示例3: createRSSItem

import com.rometools.rome.feed.rss.Content; //导入依赖的package包/类
@Override
protected Item createRSSItem(final SyndEntry sEntry) {

    final Item item = super.createRSSItem(sEntry);

    item.setComments(sEntry.getComments());

    final SyndContent sContent = sEntry.getDescription();

    if (sContent != null) {
        item.setDescription(createItemDescription(sContent));
    }

    final List<SyndContent> contents = sEntry.getContents();

    if (Lists.isNotEmpty(contents)) {
        final SyndContent syndContent = contents.get(0);
        final Content cont = new Content();
        cont.setValue(syndContent.getValue());
        cont.setType(syndContent.getType());
        item.setContent(cont);
    }

    return item;
}
 
开发者ID:rometools,项目名称:rome,代码行数:26,代码来源:ConverterForRSS091Userland.java


示例4: parseItem

import com.rometools.rome.feed.rss.Content; //导入依赖的package包/类
/**
 * Parses an item element of an RSS document looking for item information.
 * <p/>
 * It first invokes super.parseItem and then parses and injects the description property if
 * present.
 * <p/>
 *
 * @param rssRoot the root element of the RSS document in case it's needed for context.
 * @param eItem the item element to parse.
 * @return the parsed RSSItem bean.
 */
@Override
protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) {

    final Item item = super.parseItem(rssRoot, eItem, locale);

    final Element description = eItem.getChild("description", getRSSNamespace());
    if (description != null) {
        item.setDescription(parseItemDescription(rssRoot, description));
    }

    final Element encoded = eItem.getChild("encoded", getContentNamespace());
    if (encoded != null) {
        final Content content = new Content();
        content.setType(Content.HTML);
        content.setValue(encoded.getText());
        item.setContent(content);
    }

    final String about = eItem.getAttributeValue("about", getRDFNamespace());
    if (about != null) {
        item.setUri(about);
    }

    return item;
}
 
开发者ID:rometools,项目名称:rome,代码行数:37,代码来源:RSS10Parser.java


示例5: parseItem

import com.rometools.rome.feed.rss.Content; //导入依赖的package包/类
/**
 * Parses an item element of an RSS document looking for item information.
 * <p/>
 * It first invokes super.parseItem and then parses and injects the description property if
 * present.
 * <p/>
 *
 * @param rssRoot the root element of the RSS document in case it's needed for context.
 * @param eItem the item element to parse.
 * @return the parsed RSSItem bean.
 */
@Override
protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) {

    final Item item = super.parseItem(rssRoot, eItem, locale);

    final Element description = eItem.getChild("description", getRSSNamespace());
    if (description != null) {
        item.setDescription(parseItemDescription(rssRoot, description));
    }

    final Element encoded = eItem.getChild("encoded", getContentNamespace());
    if (encoded != null) {
        final Content content = new Content();
        content.setType(Content.HTML);
        content.setValue(encoded.getText());
        item.setContent(content);
    }

    return item;

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


示例6: populateItem

import com.rometools.rome.feed.rss.Content; //导入依赖的package包/类
@Override
protected void populateItem(final Item item, final Element eItem, final int index) {

    super.populateItem(item, eItem, index);

    final Description description = item.getDescription();
    if (description != null) {
        eItem.addContent(generateSimpleElement("description", description.getValue()));
    }

    final Namespace contentNamespace = getContentNamespace();
    final Content content = item.getContent();
    if (item.getModule(contentNamespace.getURI()) == null && content != null) {
        final Element elem = new Element("encoded", contentNamespace);
        elem.addContent(content.getValue());
        eItem.addContent(elem);
    }

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


示例7: createDescription

import com.rometools.rome.feed.rss.Content; //导入依赖的package包/类
private Description createDescription(Post post) {

        Long postId = post.getPostId();
        if (post.isMultiPhotoPost())
            post.setPostImages(postService.getPostImages(postId));
        if (post.isSinglePhotoPost())
            post.setSingleImage(postService.getPostImages(postId).get(0));

        Description description = new Description();
        description.setType(Content.HTML);
        description.setValue(fmService.createRssPostContent(post));
        return description;
    }
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:14,代码来源:RssPostFeedView.java


示例8: createDescription

import com.rometools.rome.feed.rss.Content; //导入依赖的package包/类
private Description createDescription(String content) {
	Description description = new Description();
	description.setType(Content.HTML);
	description.setValue(content);

	return description;
}
 
开发者ID:JakduK,项目名称:jakduk-api,代码行数:8,代码来源:DocumentRssFeedView.java


示例9: createSyndEntry

import com.rometools.rome.feed.rss.Content; //导入依赖的package包/类
@Override
protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) {

    final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);

    final Description desc = item.getDescription();
    if (desc != null) {
        final SyndContent descContent = new SyndContentImpl();
        descContent.setType(desc.getType());
        descContent.setValue(desc.getValue());
        syndEntry.setDescription(descContent);
    }

    final Content cont = item.getContent();
    if (cont != null) {

        final SyndContent contContent = new SyndContentImpl();
        contContent.setType(cont.getType());
        contContent.setValue(cont.getValue());

        final List<SyndContent> contents = new ArrayList<SyndContent>();
        contents.add(contContent);
        syndEntry.setContents(contents);

    }

    return syndEntry;

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


示例10: createSyndEntry

import com.rometools.rome.feed.rss.Content; //导入依赖的package包/类
@Override
protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) {

    final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);

    final Description desc = item.getDescription();

    syndEntry.setComments(item.getComments());

    if (desc != null) {
        final SyndContent descContent = new SyndContentImpl();
        descContent.setType(desc.getType());
        descContent.setValue(desc.getValue());
        syndEntry.setDescription(descContent);
    }

    final Content cont = item.getContent();

    if (cont != null) {
        final SyndContent content = new SyndContentImpl();
        content.setType(cont.getType());
        content.setValue(cont.getValue());

        final List<SyndContent> syndContents = new ArrayList<SyndContent>();
        syndContents.add(content);
        syndEntry.setContents(syndContents);
    }

    return syndEntry;
}
 
开发者ID:rometools,项目名称:rome,代码行数:31,代码来源:ConverterForRSS091Userland.java


示例11: toContent

import com.rometools.rome.feed.rss.Content; //导入依赖的package包/类
private SyndContent toContent(String postContent) {
    SyndContent content = new SyndContentImpl();
    content.setValue(postContent);
    content.setType(Content.HTML);
    return content;
}
 
开发者ID:tidyjava,项目名称:blogging-platform,代码行数:7,代码来源:RssFeedGenerator.java


示例12: createItemContent

import com.rometools.rome.feed.rss.Content; //导入依赖的package包/类
protected Content createItemContent(final SyndContent sContent) {
    final Content cont = new Content();
    cont.setValue(sContent.getValue());
    cont.setType(sContent.getType());
    return cont;
}
 
开发者ID:rometools,项目名称:rome,代码行数:7,代码来源:ConverterForRSS10.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TSocket类代码示例发布时间:2022-05-22
下一篇:
Java MatrixStore类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap