本文整理了Java中com.sun.syndication.feed.synd.SyndFeed.getLink()
方法的一些代码示例,展示了SyndFeed.getLink()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SyndFeed.getLink()
方法的具体详情如下:
包路径:com.sun.syndication.feed.synd.SyndFeed
类名称:SyndFeed
方法名:getLink
[英]Returns the feed link.
Note: The URI is the unique identifier, in the RSS 2.0/atom case this is the GUID, for RSS 1.0 this is the URI attribute of the item. The Link is the URL that the item is accessible under, the URI is the permanent identifier which the aggregator should use to reference this item. Often the URI will use some standardized identifier scheme such as DOI's so that items can be identified even if they appear in multiple feeds with different "links" (they might be on different hosting platforms but be the same item). Also, though rare, there could be multiple items with the same link but a different URI and associated metadata which need to be treated as distinct entities. In the RSS 1.0 case the URI must be a valid RDF URI reference.
[中]返回提要链接。
注意:URI是唯一标识符,在RSS 2.0/atom中,这是GUID,在RSS 1.0中,这是项的URI属性。链接是项目可访问的URL,URI是聚合器应用于引用该项目的永久标识符。URI通常会使用一些标准化的标识符方案,比如DOI,这样即使条目出现在多个具有不同“链接”的提要中(它们可能在不同的托管平台上,但是同一个条目),也可以识别它们。此外,虽然很少见,但可能有多个项目具有相同的链接,但不同的URI和关联的元数据需要被视为不同的实体。在RSS1.0中,URI必须是有效的RDF URI引用。
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Render the title from the given Channel to the given StringBuffer,
* using standard Radeox filtering tags.
* @param feed the RSS Channel we retrieved via the Feed URL
* @param buf the StringBuffer we're using to prepare the output
*/
private void renderTitleDefault(SyndFeed feed, StringBuffer buf) {
buf.append("__");
if (feed.getLink() != null) buf.append("{link:");
buf.append(feed.getTitle());
if (feed.getLink() != null)
{
buf.append("|")
.append(feed.getLink())
.append("}");
}
buf.append("__\n\n");
}
代码示例来源:origin: rome/rome
protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
Channel channel = new Channel(type);
channel.setModules(ModuleUtils.cloneModules(syndFeed.getModules()));
channel.setEncoding(syndFeed.getEncoding());
channel.setTitle(syndFeed.getTitle());
if (syndFeed.getLink() != null) {
channel.setLink(syndFeed.getLink());
}
else
if (syndFeed.getLinks().size() > 0) {
channel.setLink(((SyndLink)syndFeed.getLinks().get(0)).getHref());
}
channel.setDescription(syndFeed.getDescription());
SyndImage sImage = syndFeed.getImage();
if (sImage!=null) {
channel.setImage(createRSSImage(sImage));
}
List sEntries = syndFeed.getEntries();
if (sEntries!=null) {
channel.setItems(createRSSItems(sEntries));
}
if (((List)syndFeed.getForeignMarkup()).size() > 0) {
channel.setForeignMarkup(syndFeed.getForeignMarkup());
}
return channel;
}
代码示例来源:origin: com.sun.syndication/com.springsource.com.sun.syndication
protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
Channel channel = new Channel(type);
channel.setModules(ModuleUtils.cloneModules(syndFeed.getModules()));
channel.setEncoding(syndFeed.getEncoding());
channel.setTitle(syndFeed.getTitle());
if (syndFeed.getLink() != null) {
channel.setLink(syndFeed.getLink());
}
else
if (syndFeed.getLinks().size() > 0) {
channel.setLink(((SyndLink)syndFeed.getLinks().get(0)).getHref());
}
channel.setDescription(syndFeed.getDescription());
SyndImage sImage = syndFeed.getImage();
if (sImage!=null) {
channel.setImage(createRSSImage(sImage));
}
List sEntries = syndFeed.getEntries();
if (sEntries!=null) {
channel.setItems(createRSSItems(sEntries));
}
if (((List)syndFeed.getForeignMarkup()).size() > 0) {
channel.setForeignMarkup(syndFeed.getForeignMarkup());
}
return channel;
}
代码示例来源:origin: stackoverflow.com
HttpClientFeedFetcher feedFetcher = new HttpClientFeedFetcher();
try {
SyndFeed feed = feedFetcher.retrieveFeed(new URL("http://habrahabr.ru/rss/"));
System.out.println(feed.getLink());
} catch (IllegalArgumentException | IOException | FeedException | FetcherException e) {
e.printStackTrace();
}
代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss
protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
Channel channel = new Channel(type);
channel.setModules(ModuleUtils.cloneModules(syndFeed.getModules()));
channel.setEncoding(syndFeed.getEncoding());
channel.setTitle(syndFeed.getTitle());
if (syndFeed.getLink() != null) {
channel.setLink(syndFeed.getLink());
}
else
if (syndFeed.getLinks().size() > 0) {
channel.setLink(((SyndLink)syndFeed.getLinks().get(0)).getHref());
}
channel.setDescription(syndFeed.getDescription());
SyndImage sImage = syndFeed.getImage();
if (sImage!=null) {
channel.setImage(createRSSImage(sImage));
}
List sEntries = syndFeed.getEntries();
if (sEntries!=null) {
channel.setItems(createRSSItems(sEntries));
}
if (((List)syndFeed.getForeignMarkup()).size() > 0) {
channel.setForeignMarkup(syndFeed.getForeignMarkup());
}
return channel;
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
代码示例来源:origin: apache/marmotta 代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core 代码示例来源:origin: rome/rome 代码示例来源:origin: jtanza/rufus 代码示例来源:origin: rome/rome 代码示例来源:origin: org.sonatype.nexus.plugins/nexus-timeline-plugin 代码示例来源:origin: com.sun.syndication/com.springsource.com.sun.syndication 代码示例来源:origin: rome/rome 代码示例来源:origin: com.sun.syndication/com.springsource.com.sun.syndication 代码示例来源:origin: com.sun.syndication/com.springsource.com.sun.syndication 代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss 代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss 代码示例来源:origin: apache/marmotta 代码示例来源:origin: apache/marmotta/**
* Render the title from the given Channel to the given StringBuffer,
* using CSS styled 'div' tags. In this case, the title will be enclosed
* in a rss.channel.title
. If
* the channel includes a link, the title will be rendered as a link to
* that URL, and the tag will also be of class
* rss.channel.title
* @param feed the RSS Channel we retrieved via the Feed URL
* @param buf the StringBuffer we're using to prepare the output
* TODO Figure out how to stop Radeox from filtering the URLs
*/
private void renderTitleCSS(SyndFeed feed, StringBuffer buf) {
buf.append(NEWLINE).append("
if (feed.getLink() != null)
{
buf.append(" .append(Encoder.escape(feed.getLink()))
.append("\">");
}
buf.append(feed.getTitle());
if (feed.getLink() != null) buf.append("");
buf.append(NEWLINE).append("
}protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
Channel channel = new Channel(type);
channel.setModules(ModuleUtils.cloneModules(syndFeed.getModules()));
channel.setEncoding(syndFeed.getEncoding());
channel.setTitle(syndFeed.getTitle());
if (syndFeed.getLink() != null) {
channel.setLink(syndFeed.getLink());
}
else
if (syndFeed.getLinks().size() > 0) {
channel.setLink(((SyndLink)syndFeed.getLinks().get(0)).getHref());
}
channel.setDescription(syndFeed.getDescription());
SyndImage sImage = syndFeed.getImage();
if (sImage!=null) {
channel.setImage(createRSSImage(sImage));
}
List sEntries = syndFeed.getEntries();
if (sEntries!=null) {
channel.setItems(createRSSItems(sEntries));
}
if (((List)syndFeed.getForeignMarkup()).size() > 0) {
channel.setForeignMarkup(syndFeed.getForeignMarkup());
}
return channel;
}/**
* If a parameter was passed with the name "img" and the literal value "true",
* render the image from the channel (if it has one.) This requires the use
* of named parameters.
* @param feed the RSS Channel we retrieved via the Feed URL
* @param writer the output writer
* @param paramObj our parameter helper object
* @throws java.io.IOException from calls to writer.write()
*/
private void renderImage(SyndFeed feed, Writer writer, RSSMacroParameters paramObj) throws java.io.IOException
{
if (feed.getImage() == null) return;
if (!(paramObj.isImg())) return;
SyndImage rssImage = feed.getImage();
StringBuffer buf = new StringBuffer(NEWLINE + "{image:");
buf.append("img=").append(rssImage.getUrl());
buf.append("|link=").append(feed.getLink());
buf.append("|align=").append(paramObj.getAlign());
if (rssImage.getDescription() != null)
{
buf.append("|alt=").append(rssImage.getDescription());
}
buf.append("}");
Logger.debug("*** RSS image: " + buf);
writer.write(buf.toString());
}if (alternateLinks.size() == 0 && syndFeed.getLink() != null) {
Link link = new Link();
link.setRel("alternate");
link.setHref(syndFeed.getLink());
alternateLinks.add(link);private Map
Listif (alternateLinks.size() == 0 && syndFeed.getLink() != null) {
Link link = new Link();
link.setRel("alternate");
link.setHref(syndFeed.getLink());
alternateLinks.add(link);if (feed.getLink() != null) {
if (!feed.getLink().startsWith("http")) {
if (feed.getLink().startsWith("/")) {
feed.setLink(feed.getLink().substring(1));
feed.setLink(createRootReference(request, feed.getLink()).toString());if (alternateLinks.size() == 0 && syndFeed.getLink() != null) {
Link link = new Link();
link.setRel("alternate");
link.setHref(syndFeed.getLink());
alternateLinks.add(link);protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
Channel channel = (Channel) super.createRealFeed(type,syndFeed);
if (syndFeed.getUri() != null) {
channel.setUri(syndFeed.getUri());
} else {
// if URI is not set use the value for link
channel.setUri(syndFeed.getLink());
}
return channel;
}if (alternateLinks.size() == 0 && syndFeed.getLink() != null) {
Link link = new Link();
link.setRel("alternate");
link.setHref(syndFeed.getLink());
alternateLinks.add(link);protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
Channel channel = (Channel) super.createRealFeed(type,syndFeed);
if (syndFeed.getUri() != null) {
channel.setUri(syndFeed.getUri());
} else {
// if URI is not set use the value for link
channel.setUri(syndFeed.getLink());
}
return channel;
}if (alternateLinks.isEmpty() && syndFeed.getLink() != null) {
Link link = new Link();
link.setRel("alternate");
link.setHref(syndFeed.getLink());
alternateLinks.add(link);@Override
protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
Channel channel = (Channel) super.createRealFeed(type,syndFeed);
if (syndFeed.getUri() != null) {
channel.setUri(syndFeed.getUri());
} else {
// if URI is not set use the value for link
channel.setUri(syndFeed.getLink());
}
return channel;
}if (alternateLinks.isEmpty() && syndFeed.getLink() != null) {
Link link = new Link();
link.setRel("alternate");
link.setHref(syndFeed.getLink());
alternateLinks.add(link);@Override
protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
Channel channel = (Channel) super.createRealFeed(type,syndFeed);
if (syndFeed.getUri() != null) {
channel.setUri(syndFeed.getUri());
} else {
// if URI is not set use the value for link
channel.setUri(syndFeed.getLink());
}
return channel;
}
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有