本文整理匯總了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);
}