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


Java Item.setEnclosures方法代码示例

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


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

示例1: createRSSItem

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

    final Item item = super.createRSSItem(sEntry);

    final List<SyndCategory> sCats = sEntry.getCategories(); // c
    if (!sCats.isEmpty()) {
        item.setCategories(createRSSCategories(sCats));
    }

    final List<SyndEnclosure> sEnclosures = sEntry.getEnclosures();
    if (!sEnclosures.isEmpty()) {
        item.setEnclosures(createEnclosures(sEnclosures));
    }

    return item;

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

示例2: buildFeedItems

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
protected List buildFeedItems(Map model, HttpServletRequest request, HttpServletResponse response)
    throws Exception {
	
    List<Episode> episodes = (List<Episode>) model.get("list_of_episodes");
    List<Item> items = new ArrayList<Item>(episodes.size());

    for (Episode episode : episodes) {
        Item item = new Item();
        String date = String.format("%1$tY-%1$tm-%1$td", episode.getPublicationDate());
        item.setTitle(episode.getTitle());
        item.setPubDate(episode.getPublicationDate());
        item.setLink(model.get("HOST_AND_PORT_URL") + "/podcasts/" + episode.getPodcastId() 
        		+ "/" + episode.getPodcast().getTitleInUrl()+ "/episodes/" + episode.getEpisodeId()
        		+ "/" + episode.getTitleInUrl());
        
        Description episodeDescription = new Description();
        episodeDescription.setValue(episode.getDescription());
        item.setDescription(episodeDescription);  
        
        //set enclosures
        List<Enclosure> enclosures = new ArrayList<Enclosure>();
        Enclosure enclosure = new Enclosure();
        enclosure.setUrl(episode.getMediaUrl());
        if(episode.getLength() != null) enclosure.setLength(episode.getLength());
        if(episode.getEnclosureType() != null ) enclosure.setType(episode.getEnclosureType()); 
        enclosures.add(enclosure);
        item.setEnclosures(enclosures);
        
        items.add(item);
    }

    return items;
}
 
开发者ID:PodcastpediaOrg,项目名称:podcastpedia-web,代码行数:34,代码来源:FoundEpisodesRssFeedView.java

示例3: buildFeedItems

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
protected List buildFeedItems(Map model, HttpServletRequest request, HttpServletResponse response)
    throws Exception {
	
    List<Podcast> podcasts = (List<Podcast>) model.get("list_of_podcasts");
    List<Item> items = new ArrayList<Item>(podcasts.size());

    for (Podcast podcast : podcasts) {
        Episode episode = podcast.getLastEpisode();
        Item item = new Item();
        String date = String.format("%1$tY-%1$tm-%1$td", episode.getPublicationDate());
        item.setTitle(podcast.getTitle()+ " - " + episode.getTitle());
        item.setPubDate(podcast.getPublicationDate());
        item.setLink( model.get("HOST_AND_PORT_URL") + "/podcasts/" + podcast.getPodcastId() 
        		+ "/" + podcast.getTitleInUrl() );
        
        Description episodeDescription = new Description();
        episodeDescription.setValue(episode.getDescription());
        item.setDescription(episodeDescription);  
        
        //set enclosures
        List<Enclosure> enclosures = new ArrayList<Enclosure>();
        Enclosure enclosure = new Enclosure();
        enclosure.setUrl(episode.getMediaUrl());    
        if(episode.getLength() != null) enclosure.setLength(episode.getLength());
        if(episode.getEnclosureType() != null ) enclosure.setType(episode.getEnclosureType());             
        enclosures.add(enclosure);
        item.setEnclosures(enclosures);
        
        items.add(item);
    }

    return items;
}
 
开发者ID:PodcastpediaOrg,项目名称:podcastpedia-web,代码行数:34,代码来源:GenericRssFeedView.java


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