本文整理汇总了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;
}
示例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;
}
示例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;
}