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


Java SyndFeed.setLink方法代码示例

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


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

示例1: testCreate

import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
public void testCreate() throws Exception {

        final SyndFeed feed = new SyndFeedImpl();
        final String feedType = "rss_2.0";
        feed.setFeedType(feedType);
        feed.setLanguage("en-us");
        feed.setTitle("sales.com on the Radio!");
        feed.setDescription("sales.com radio shows in MP3 format");
        feed.setLink("http://foo/rss/podcasts.rss");

        final FeedInformation fi = new FeedInformationImpl();
        fi.setOwnerName("sales.com");
        fi.getCategories().add(new Category("Shopping"));
        fi.setOwnerEmailAddress("[email protected]");
        fi.setType("serial");
        feed.getModules().add(fi);

        final SyndFeedOutput output = new SyndFeedOutput();
        final StringWriter writer = new StringWriter();
        output.output(feed, writer);
        LOG.debug("{}", writer);

    }
 
开发者ID:rometools,项目名称:rome,代码行数:24,代码来源:ITunesGeneratorTest.java

示例2: testCreate

import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
public void testCreate() throws Exception {

        final SyndFeed feed = new SyndFeedImpl();
        final String feedType = "rss_2.0";
        feed.setFeedType(feedType);
        feed.setLanguage("en-us");
        feed.setTitle("sales.com on the Radio!");
        feed.setDescription("sales.com radio shows in MP3 format");
        feed.setLink("http://foo/rss/podcasts.rss");

        final FeedInformation fi = new FeedInformationImpl();
        fi.setOwnerName("sales.com");
        fi.getCategories().add(new Category("Shopping"));
        fi.setOwnerEmailAddress("[email protected]");
        feed.getModules().add(fi);

        final SyndFeedOutput output = new SyndFeedOutput();
        final StringWriter writer = new StringWriter();
        output.output(feed, writer);
        LOG.debug("{}", writer);

    }
 
开发者ID:rometools,项目名称:rome-modules,代码行数:23,代码来源:ITunesGeneratorTest.java

示例3: writeRevisionsFeed

import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
private void writeRevisionsFeed(HttpServletRequest request, HttpServletResponse response, ServiceMap serviceMap) throws IOException, FeedException, ServiceException, PublicInterfaceNotFoundException {
	long poid = Long.parseLong(request.getParameter("poid"));
	SProject sProject = serviceMap.getServiceInterface().getProjectByPoid(poid);

	SyndFeed feed = new SyndFeedImpl();
	feed.setFeedType(FEED_TYPE);

	feed.setTitle("BIMserver.org revisions feed for project '" + sProject.getName() + "'");
	feed.setLink(request.getContextPath());
	feed.setDescription("This feed represents all the revisions of project '" + sProject.getName() + "'");

	List<SyndEntry> entries = new ArrayList<SyndEntry>();
	try {
		List<SRevision> allRevisionsOfProject = serviceMap.getServiceInterface().getAllRevisionsOfProject(poid);
		Collections.sort(allRevisionsOfProject, new SRevisionIdComparator(false));
		for (SRevision sVirtualRevision : allRevisionsOfProject) {
			SUser user = serviceMap.getServiceInterface().getUserByUoid(sVirtualRevision.getUserId());
			SyndEntry entry = new SyndEntryImpl();
			entry.setTitle("Revision " + sVirtualRevision.getOid());
			entry.setLink(request.getContextPath() + "/revision.jsp?poid=" + sVirtualRevision.getOid() + "&roid=" + sVirtualRevision.getOid());
			entry.setPublishedDate(sVirtualRevision.getDate());
			SyndContent description = new SyndContentImpl();
			description.setType("text/html");
			description.setValue("<table><tr><td>User</td><td>" + user.getUsername() + "</td></tr><tr><td>Comment</td><td>" + sVirtualRevision.getComment()
					+ "</td></tr></table>");
			entry.setDescription(description);
			entries.add(entry);
		}
	} catch (ServiceException e) {
		LOGGER.error("", e);
	}
	feed.setEntries(entries);
	SyndFeedOutput output = new SyndFeedOutput();
	output.output(feed, response.getWriter());
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:36,代码来源:SyndicationServlet.java

示例4: writeCheckoutsFeed

import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
private void writeCheckoutsFeed(HttpServletRequest request, HttpServletResponse response, ServiceMap serviceMap) throws ServiceException, IOException, FeedException, PublicInterfaceNotFoundException {
	long poid = Long.parseLong(request.getParameter("poid"));
	SProject sProject = serviceMap.getServiceInterface().getProjectByPoid(poid);

	SyndFeed feed = new SyndFeedImpl();
	feed.setFeedType(FEED_TYPE);

	feed.setTitle("BIMserver.org checkouts feed for project '" + sProject.getName() + "'");
	feed.setLink(request.getContextPath());
	feed.setDescription("This feed represents all the checkouts of project '" + sProject.getName() + "'");

	List<SyndEntry> entries = new ArrayList<SyndEntry>();
	try {
		List<SCheckout> allCheckoutsOfProject = serviceMap.getServiceInterface().getAllCheckoutsOfProjectAndSubProjects(poid);
		for (SCheckout sCheckout : allCheckoutsOfProject) {
			SRevision revision = serviceMap.getServiceInterface().getRevision(sCheckout.getRevision().getOid());
			SProject project = serviceMap.getServiceInterface().getProjectByPoid(sCheckout.getProjectId());
			SUser user = serviceMap.getServiceInterface().getUserByUoid(sCheckout.getUserId());
			SyndEntry entry = new SyndEntryImpl();
			entry.setTitle("Checkout on " + project.getName() + ", revision " + revision.getId());
			entry.setLink(request.getContextPath() + "/project.jsp?poid=" + sProject.getOid());
			entry.setPublishedDate(sCheckout.getDate());
			SyndContent description = new SyndContentImpl();
			description.setType("text/plain");
			description
					.setValue("<table><tr><td>User</td><td>" + user.getUsername() + "</td></tr><tr><td>Revision</td><td>" + sCheckout.getRevision().getOid() + "</td></tr></table>");
			entry.setDescription(description);
			entries.add(entry);
		}
	} catch (UserException e) {
		LOGGER.error("", e);
	}
	feed.setEntries(entries);
	SyndFeedOutput output = new SyndFeedOutput();
	output.output(feed, response.getWriter());
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:37,代码来源:SyndicationServlet.java

示例5: copyInto

import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
@Override
public void copyInto(final WireFeed feed, final SyndFeed syndFeed) {

    syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));

    final List<Element> foreignMarkup = feed.getForeignMarkup();
    if (!foreignMarkup.isEmpty()) {
        syndFeed.setForeignMarkup(foreignMarkup);
    }

    syndFeed.setStyleSheet(feed.getStyleSheet());

    syndFeed.setEncoding(feed.getEncoding());

    final Channel channel = (Channel) feed;

    syndFeed.setTitle(channel.getTitle());
    syndFeed.setLink(channel.getLink());
    syndFeed.setDescription(channel.getDescription());

    final Image image = channel.getImage();
    if (image != null) {
        syndFeed.setImage(createSyndImage(image));
    }

    final List<Item> items = channel.getItems();
    if (items != null) {
        syndFeed.setEntries(createSyndEntries(items, syndFeed.isPreservingWireFeed()));
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:31,代码来源:ConverterForRSS090.java

示例6: run

import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
@Override
public void run()
{
	// Not terribly efficient
	AbstractRootSearchSection<?> rootSearch = info.lookupSection(AbstractRootSearchSection.class);
	AbstractFreetextResultsSection<?, ?> searchResults = info
		.lookupSection(AbstractFreetextResultsSection.class);

	FreetextSearchEvent event = searchResults.createSearchEvent(info);
	info.processEvent(event);

	FreetextSearchResults<FreetextResult> results = freeTextService.search(event.getFinalSearch(), 0, length);
	if( feedType.equals("rss_2.0") )
	{
		response.setContentType("application/rss+xml; charset=UTF-8");
	}
	else
	{
		response.setContentType("application/atom+xml; charset=UTF-8");
	}
	SyndFeed feed = getFeed(info, searchResults, results);

	feed.setFeedType(feedType);
	String title = rootSearch.getTitle(info).getText();
	feed.setTitle(title);
	String urlPath = path;
	if( urlPath != null && urlPath.startsWith("/") )
	{
		urlPath = urlPath.substring(1);
	}
	feed.setLink(institutionService.institutionalise(urlPath));
	feed.setDescription(title);
	WireFeed wfeed = feed.createWireFeed(feedType);
	if( wfeed instanceof Feed )
	{
		// add compulsory Atom fields
		Feed atomFeed = (Feed) wfeed;
		atomFeed.setId(institutionService.institutionalise("atom_1.0"));
		atomFeed.setUpdated(new Date());
	}

	WireFeedOutput outputter = new WireFeedOutput();
	try
	{
		outputter.output(wfeed, response.getWriter());
	}
	catch( Exception fe )
	{
		throw new RuntimeException(fe);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:52,代码来源:FeedServlet.java

示例7: main

import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
public static void main(final String[] args) {

        boolean ok = false;

        if (args.length >= 2) {

            try {

                final String outputType = args[0];

                final SyndFeed feed = new SyndFeedImpl();
                feed.setFeedType(outputType);

                feed.setTitle("Aggregated Feed");
                feed.setDescription("Anonymous Aggregated Feed");
                feed.setAuthor("anonymous");
                feed.setLink("http://www.anonymous.com");

                final List<SyndEntry> entries = new ArrayList<SyndEntry>();
                feed.setEntries(entries);

                final FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getInstance();
                final FeedFetcher feedFetcher = new HttpURLFeedFetcher(feedInfoCache);

                for (int i = 1; i < args.length; i++) {
                    final URL inputUrl = new URL(args[i]);
                    final SyndFeed inFeed = feedFetcher.retrieveFeed(inputUrl);
                    entries.addAll(inFeed.getEntries());
                }

                final SyndFeedOutput output = new SyndFeedOutput();
                output.output(feed, new PrintWriter(System.out));

                ok = true;

            } catch (final Exception ex) {
                System.out.println("ERROR: " + ex.getMessage());
                ex.printStackTrace();
            }

        }

        if (!ok) {
            System.out.println();
            System.out.println("FeedAggregator aggregates different feeds into a single one.");
            System.out.println("The first parameter must be the feed type for the aggregated feed.");
            System.out.println(" [valid values are: rss_0.9, rss_0.91, rss_0.92, rss_0.93, ]");
            System.out.println(" [                  rss_0.94, rss_1.0, rss_2.0 & atom_0.3  ]");
            System.out.println("The second to last parameters are the URLs of feeds to aggregate.");
            System.out.println();
        }
    }
 
开发者ID:rometools,项目名称:rome,代码行数:53,代码来源:FeedAggregator.java


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