当前位置: 首页>>代码示例>>Java>>正文


Java Channel.setLink方法代码示例

本文整理汇总了Java中com.sun.syndication.feed.rss.Channel.setLink方法的典型用法代码示例。如果您正苦于以下问题:Java Channel.setLink方法的具体用法?Java Channel.setLink怎么用?Java Channel.setLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.syndication.feed.rss.Channel的用法示例。


在下文中一共展示了Channel.setLink方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRealFeed

import com.sun.syndication.feed.rss.Channel; //导入方法依赖的package包/类
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());
    channel.setLink(syndFeed.getLink());
    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));
    }
    return channel;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:ConverterForRSS090.java

示例2: writeOtherCharset

import com.sun.syndication.feed.rss.Channel; //导入方法依赖的package包/类
@Test
public void writeOtherCharset() throws IOException, SAXException {
	Channel channel = new Channel("rss_2.0");
	channel.setTitle("title");
	channel.setLink("http://example.com");
	channel.setDescription("description");

	String encoding = "ISO-8859-1";
	channel.setEncoding(encoding);

	Item item1 = new Item();
	item1.setTitle("title1");

	MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
	converter.write(channel, null, outputMessage);

	assertEquals("Invalid content-type", new MediaType("application", "rss+xml", Charset.forName(encoding)),
			outputMessage.getHeaders().getContentType());
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:20,代码来源:RssChannelHttpMessageConverterTests.java

示例3: parseChannel

import com.sun.syndication.feed.rss.Channel; //导入方法依赖的package包/类
/**
 * Parses the root element of an RSS document into a Channel bean.
 * <p/>
 * It reads title, link and description and delegates to parseImage, parseItems
 * and parseTextInput. This delegation always passes the root element of the RSS
 * document as different RSS version may have this information in different parts
 * of the XML tree (no assumptions made thanks to the specs variaty)
 * <p/>
 *
 * @param rssRoot the root element of the RSS document to parse.
 * @return the parsed Channel bean.
 */
protected WireFeed parseChannel(Element rssRoot) {
    Element eChannel = rssRoot.getChild("channel",getRSSNamespace());

    Channel channel = new Channel(getType());

    Element e = eChannel.getChild("title",getRSSNamespace());
    if (e!=null) {
        channel.setTitle(e.getText());
    }
    e = eChannel.getChild("link",getRSSNamespace());
    if (e!=null) {
        channel.setLink(e.getText());
    }
    e = eChannel.getChild("description",getRSSNamespace());
    if (e!=null) {
        channel.setDescription(e.getText());
    }

    channel.setImage(parseImage(rssRoot));

    channel.setTextInput(parseTextInput(rssRoot));

    channel.setItems(parseItems(rssRoot));

    channel.setModules(parseFeedModules(eChannel));

    return channel;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:41,代码来源:RSS090Parser.java

示例4: doSyndication

import com.sun.syndication.feed.rss.Channel; //导入方法依赖的package包/类
/**
 * This puts the pieces together to generate the actual feed.
 * 
 * @param title
 *            The global title for the podcast
 * @param link
 *            The URL for the feed
 * @param description_loc
 *            Global description of the feed
 * @param copyright
 *            Copyright information
 * @param entries
 *            The list of individual podcasts
 * @param feedTyle
 * 			 The output feed type (for potential future development). Set to rss_2.0
 * @param pubDate
 * 			 The date to set the publish date for this feed
 * 
 * @eturn SyndFeed
 * 			The entire podcast stuffed into a SyndFeed object
 */
private Channel doSyndication(Map feedInfo, List entries,
		String feedType, Date pubDate, Date lastBuildDate) {

	final Channel channel = new Channel();

	// FUTURE: How to determine what podcatcher supports and feed that to them
	channel.setFeedType(feedType);
	channel.setTitle((String) feedInfo.get("title"));
	channel.setLanguage(LANGUAGE);

	channel.setPubDate(pubDate);
	channel.setLastBuildDate(lastBuildDate);

	channel.setLink((String) feedInfo.get("url"));
	channel.setDescription((String) feedInfo.get("desc"));		
	channel.setCopyright((String) feedInfo.get("copyright"));
	channel.setGenerator((String) feedInfo.get("gen"));

	channel.setItems(entries);

	// Used to remove the dc: tags from the channel level info
	List modules = new ArrayList();
	
	channel.setModules(modules);

	return channel;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:49,代码来源:BasicPodfeedService.java

示例5: newFeed

import com.sun.syndication.feed.rss.Channel; //导入方法依赖的package包/类
@Override
protected Channel newFeed() {
    Channel channel = super.newFeed();
    channel.setTitle(username);
    channel.setDescription(baseUrl);
    channel.setLink(baseUrl + "/" + username + "/rss");
    channel.setEncoding("utf-8");
    return channel;
}
 
开发者ID:Glamdring,项目名称:welshare,代码行数:10,代码来源:MessageController.java

示例6: createRealFeed

import com.sun.syndication.feed.rss.Channel; //导入方法依赖的package包/类
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;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:31,代码来源:ConverterForRSS090.java

示例7: newFeed

import com.sun.syndication.feed.rss.Channel; //导入方法依赖的package包/类
@Override
protected Channel newFeed() {
    Channel channel = super.newFeed();
    channel.setTitle("Computoser - computser-generaces music");
    channel.setDescription(baseUrl);
    channel.setLink(baseUrl + "/rss");
    channel.setEncoding("utf-8");
    return channel;
}
 
开发者ID:Glamdring,项目名称:computoser,代码行数:10,代码来源:MusicController.java

示例8: write

import com.sun.syndication.feed.rss.Channel; //导入方法依赖的package包/类
@Test
public void write() throws IOException, SAXException {
	Channel channel = new Channel("rss_2.0");
	channel.setTitle("title");
	channel.setLink("http://example.com");
	channel.setDescription("description");

	Item item1 = new Item();
	item1.setTitle("title1");

	Item item2 = new Item();
	item2.setTitle("title2");

	List<Item> items = new ArrayList<Item>(2);
	items.add(item1);
	items.add(item2);
	channel.setItems(items);

	MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
	converter.write(channel, null, outputMessage);

	assertEquals("Invalid content-type", new MediaType("application", "rss+xml", utf8),
			outputMessage.getHeaders().getContentType());
	String expected = "<rss version=\"2.0\">" +
			"<channel><title>title</title><link>http://example.com</link><description>description</description>" +
			"<item><title>title1</title></item>" +
			"<item><title>title2</title></item>" +
			"</channel></rss>";
	assertXMLEqual(expected, outputMessage.getBodyAsString(utf8));
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:31,代码来源:RssChannelHttpMessageConverterTests.java

示例9: buildFeedMetadata

import com.sun.syndication.feed.rss.Channel; //导入方法依赖的package包/类
@Override
protected void buildFeedMetadata(Map<String, Object> model, Channel feed, HttpServletRequest request) {

	feed.setTitle("Ephesoft RSS feed");
	feed.setDescription("Ephesoft RSS feed");
	feed.setLink("http://");

	super.buildFeedMetadata(model, feed, request);
}
 
开发者ID:bchevallereau,项目名称:ephesoft-extension,代码行数:10,代码来源:CustomRssViewer.java

示例10: parseChannel

import com.sun.syndication.feed.rss.Channel; //导入方法依赖的package包/类
/**
 * Parses the root element of an RSS document into a Channel bean.
 * <p/>
 * It reads title, link and description and delegates to parseImage, parseItems
 * and parseTextInput. This delegation always passes the root element of the RSS
 * document as different RSS version may have this information in different parts
 * of the XML tree (no assumptions made thanks to the specs variaty)
 * <p/>
 *
 * @param rssRoot the root element of the RSS document to parse.
 * @return the parsed Channel bean.
 */
protected WireFeed parseChannel(Element rssRoot) {
    Element eChannel = rssRoot.getChild("channel", getRSSNamespace());

    Channel channel = new Channel(getType());

    Element e = eChannel.getChild("title",getRSSNamespace());
    if (e!=null) {
        channel.setTitle(e.getText());
    }
    e = eChannel.getChild("link",getRSSNamespace());
    if (e!=null) {
        channel.setLink(e.getText());
    }
    e = eChannel.getChild("description",getRSSNamespace());
    if (e!=null) {
        channel.setDescription(e.getText());
    }

    channel.setImage(parseImage(rssRoot));

    channel.setTextInput(parseTextInput(rssRoot));

    // Unfortunately Microsoft's SSE extension has a special case of 
    // effectively putting the sharing channel module inside the RSS tag 
    // and not inside the channel itself. So we also need to look for 
    // channel modules from the root RSS element.
    List allFeedModules = new ArrayList();
    List rootModules = parseFeedModules(rssRoot);
    List channelModules = parseFeedModules(eChannel); 
    if (rootModules != null) {
        allFeedModules.addAll(rootModules);
    }
    if (channelModules != null) {
        allFeedModules.addAll(channelModules);
    }
    channel.setModules(allFeedModules);
    channel.setItems(parseItems(rssRoot));

    List foreignMarkup = 
        extractForeignMarkup(eChannel, channel, getRSSNamespace());
    if (foreignMarkup.size() > 0) {
        channel.setForeignMarkup(foreignMarkup);
    }          
    return channel;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:58,代码来源:RSS090Parser.java

示例11: buildFeedMetadata

import com.sun.syndication.feed.rss.Channel; //导入方法依赖的package包/类
@Override
protected void buildFeedMetadata(Map model, Channel channel, HttpServletRequest request) {
	channel.setTitle("Test Feed");
	channel.setDescription("Test feed description");
	channel.setLink("http://example.com");
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:7,代码来源:RssFeedViewTests.java


注:本文中的com.sun.syndication.feed.rss.Channel.setLink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。