本文整理汇总了Java中com.rometools.rome.feed.synd.SyndFeed.getLinks方法的典型用法代码示例。如果您正苦于以下问题:Java SyndFeed.getLinks方法的具体用法?Java SyndFeed.getLinks怎么用?Java SyndFeed.getLinks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rometools.rome.feed.synd.SyndFeed
的用法示例。
在下文中一共展示了SyndFeed.getLinks方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateLink
import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
private void validateLink(final SyndFeed feed, final String source) {
for (final SyndLink l : feed.getLinks()) {
if ("self".equalsIgnoreCase(l.getRel())) {
try {
final URI u = new URI(l.getHref());
final URI t = new URI(source);
if (!u.equals(t)) {
throw new HttpStatusCodeException(400, "Feed self link does not match the subscribed URI.", null);
}
break;
} catch (final URISyntaxException ex) {
LOG.error(null, ex);
}
}
}
}
示例2: getNextPageUrl
import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
private String getNextPageUrl(Config config, SyndFeed page, String feedKey) {
String result = "";
if (null != page.getLinks() && CollectionUtils.isNotEmpty(page.getLinks())) {
for (SyndLink link : page.getLinks()) {
if (NEXT_ARCHIVE.equals(link.getRel())) {
result = link.getHref();
updateCurrentPageId(config, result, feedKey);
break;
}
}
}
return result;
}
示例3: sendUpdateNotification
import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
/**
* Sends a notification for a feed located at "topic". The feed MUST contain rel="hub".
*
* @param topic URL for the feed
* @param feed The feed itself
* @throws NotificationException Any failure
*/
public void sendUpdateNotification(final String topic, final SyndFeed feed) throws NotificationException {
for (final SyndLink link : feed.getLinks()) {
if ("hub".equals(link.getRel())) {
sendUpdateNotification(link.getRel(), topic);
return;
}
}
throw new NotificationException("Hub link not found.");
}
示例4: findHubUrl
import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
private String findHubUrl(final SyndFeed feed) {
for (final SyndLink l : feed.getLinks()) {
if ("hub".equals(l.getRel())) {
return l.getHref();
}
}
return null;
}
示例5: createRealFeed
import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
protected WireFeed createRealFeed(final String type, final SyndFeed syndFeed) {
final Channel channel = new Channel(type);
channel.setModules(ModuleUtils.cloneModules(syndFeed.getModules()));
channel.setStyleSheet(syndFeed.getStyleSheet());
channel.setEncoding(syndFeed.getEncoding());
channel.setTitle(syndFeed.getTitle());
final String link = syndFeed.getLink();
final List<SyndLink> links = syndFeed.getLinks();
if (link != null) {
channel.setLink(link);
} else if (!links.isEmpty()) {
channel.setLink(links.get(0).getHref());
}
channel.setDescription(syndFeed.getDescription());
final SyndImage sImage = syndFeed.getImage();
if (sImage != null) {
channel.setImage(createRSSImage(sImage));
}
final List<SyndEntry> sEntries = syndFeed.getEntries();
if (sEntries != null) {
channel.setItems(createRSSItems(sEntries));
}
final List<Element> foreignMarkup = syndFeed.getForeignMarkup();
if (!foreignMarkup.isEmpty()) {
channel.setForeignMarkup(foreignMarkup);
}
return channel;
}
示例6: findHub
import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
private String findHub(SyndFeed feed) {
for (SyndLink l : feed.getLinks()) {
if ("hub".equalsIgnoreCase(l.getRel())) {
log.debug("found hub {} for feed {}", l.getHref(), feed.getLink());
return l.getHref();
}
}
return null;
}
示例7: findSelf
import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
private String findSelf(SyndFeed feed) {
for (SyndLink l : feed.getLinks()) {
if ("self".equalsIgnoreCase(l.getRel())) {
log.debug("found self {} for feed {}", l.getHref(), feed.getLink());
return l.getHref();
}
}
return null;
}