本文整理汇总了Java中com.sun.syndication.feed.synd.SyndFeed.getTitle方法的典型用法代码示例。如果您正苦于以下问题:Java SyndFeed.getTitle方法的具体用法?Java SyndFeed.getTitle怎么用?Java SyndFeed.getTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.syndication.feed.synd.SyndFeed
的用法示例。
在下文中一共展示了SyndFeed.getTitle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SyndEntryAdapter
import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
public SyndEntryAdapter(SyndFeed feed, SyndEntry entry) {
if (entry.getTitleEx() != null) {
this.title = entry.getTitle();
this.titleType = entry.getTitleEx().getType();
}
if (entry.getDescription() != null) {
this.description = entry.getDescription().getValue();
this.descriptionType = entry.getDescription().getType();
}
this.uri = entry.getUri();
this.author = entry.getAuthor();
this.link = entry.getLink();
if (entry.getPublishedDate() != null)
this.publishedDate = ISO_8601_DATE_FORMAT.format(entry.getPublishedDate());
if (entry.getUpdatedDate() != null)
this.updatedDate = ISO_8601_DATE_FORMAT.format(entry.getUpdatedDate());
this.fetchDate = ISO_8601_DATE_FORMAT.format(new Date());
this.sourceLink = feed.getLink();
this.sourceUri = feed.getUri();
this.sourceTitle = feed.getTitle();
this.language = feed.getLanguage();
this.sourceType = feed.getFeedType();
}
示例2: createFeed
import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
protected Feed createFeed(long id, String feedUrl, SyndFeed syndFeed) {
String selfUrl = syndFeed.getLink() != null ? syndFeed.getLink() : feedUrl;
// TODO: author
return new Feed(
id,
0,
selfUrl,
syndFeed.getTitle() != null && syndFeed.getTitle().length() > 0 ? syndFeed.getTitle() : feedUrl,
syndFeed.getDescription() != null && syndFeed.getDescription().length() > 0 ? syndFeed.getDescription() : "-",
syndFeed.getPublishedDate() != null ? syndFeed.getPublishedDate().getTime() : 0
);
}
示例3: parse
import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void parse() throws Exception {
SyndFeedInput input = new SyndFeedInput();
byte b[] = downloadAndSendBinary(url);
if (b != null) {
SyndFeed feed = input.build(new XmlReader(new ByteArrayInputStream(b)));
name = feed.getTitle();
if (feed.getCategories() != null && feed.getCategories().size() > 0) {
SyndCategory category = (SyndCategory) feed.getCategories().get(0);
tempCategory = category.getName();
}
List<SyndEntry> entries = feed.getEntries();
for (SyndEntry entry : entries) {
tempItemTitle = entry.getTitle();
tempItemLink = entry.getLink();
tempFeedLink = entry.getUri();
tempItemThumbURL = null;
ArrayList<Element> elements = (ArrayList<Element>) entry.getForeignMarkup();
for (Element elt : elements) {
if ("group".equals(elt.getName()) && "media".equals(elt.getNamespacePrefix())) {
List<Content> subElts = elt.getContent();
for (Content subelt : subElts) {
if (subelt instanceof Element) {
parseElement((Element) subelt, false);
}
}
}
parseElement(elt, true);
}
List<SyndEnclosure> enclosures = entry.getEnclosures();
for (SyndEnclosure enc : enclosures) {
if (StringUtils.isNotBlank(enc.getUrl())) {
tempItemLink = enc.getUrl();
}
}
manageItem();
}
}
setLastModified(System.currentTimeMillis());
}
示例4: feedUpdate
import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
/**
* Updates feed information such as accessed time and other attributes
* pertaining feed/channel.
*
* @param feedDB
* @param feed
*/
@SuppressWarnings("unchecked")
private void feedUpdate(DBObject feedDB, SyndFeed feed) {
// this field is for RSS Delegate worker to check for stalled threads or
// threads that crashed and were not able to update used filed back to 0
feedDB.put("accessedAt", new Date());
/******** REQUIRED channel elements as defined in RSS 2.0 Specification ********/
// http://cyber.law.harvard.edu/rss/rss.html#
// even though this elements are required by specification we
// cannot trust the source
if (feed.getTitle() != null)
feedDB.put("title", feed.getTitle());
if (feed.getLink() != null)
feedDB.put("link", feed.getLink());
if (feed.getDescription() != null)
feedDB.put("description", feed.getDescription());
/******** OPTIONAL channel elements as defined in RSS 2.0 Specification ********/
if (feed.getLanguage() != null)
feedDB.put("language", feed.getLanguage());
if (feed.getCopyright() != null)
feedDB.put("copyright", feed.getCopyright());
// no specific get method for managing editor and web master in rome
// library. Using authors instead
if (feed.getAuthors() != null && feed.getAuthors().size() > 0) {
ArrayList<BasicDBObject> authors = getAuthors((ArrayList<SyndPerson>) feed
.getAuthors());
feedDB.put("authors", authors);
}
if (feed.getPublishedDate() != null)
feedDB.put("pubDate", feed.getPublishedDate());
// last build date does not exist in rome library
if (feed.getCategories() != null && feed.getCategories().size() > 0) {
ArrayList<BasicDBObject> categories = getCategories((ArrayList<SyndCategory>) feed
.getCategories());
feedDB.put("category", categories);
}
// generator does not exist in rome library
// docs does not exist in rome library
// cloud does not exist in rome library
// ttl does not exist in rome library
SyndImage feedImage = feed.getImage();
if (feedImage != null) {
BasicDBObject imageDB = new BasicDBObject();
if (feedImage.getUrl() != null)
imageDB.append("url", feedImage.getUrl());
if (feedImage.getTitle() != null)
imageDB.append("title", feedImage.getTitle());
if (feedImage.getLink() != null)
imageDB.append("link", feedImage.getLink());
if (feedImage.getDescription() != null)
imageDB.append("description", feedImage.getDescription());
if (feedImage.getUrl() != null || feedImage.getTitle() != null
|| feedImage.getLink() != null
|| feedImage.getDescription() != null)
feedDB.put("image", imageDB);
// width does not exist in rome library
// height does not exist in rome library
}
// rating does not exist in rome library
// text input does not exist in rome library
// skip hours does not exist in rome library
// skip days does not exist in rome library
rssColl.update(new BasicDBObject("feedUrl", feedDB.get("feedUrl")),
feedDB);
}