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


Java SyndFeed.setFeedType方法代码示例

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


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

示例1: generateFeed

import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
public SyndFeed generateFeed( String title, String description, List<RssFeedEntry> dataEntries )
{
    if( dataEntries.size() ==  0 )
    {
        log.debug( "No updates found, feed not generated." );
        return null;
    }
    
    SyndFeed feed = new SyndFeedImpl();
    feed.setTitle( title );        
    feed.setDescription( description );
    feed.setLanguage( DEFAULT_LANGUAGE );
    feed.setPublishedDate( dataEntries.get( dataEntries.size() - 1 ).getPublishedDate() );
    feed.setFeedType( DEFAULT_FEEDTYPE );
    feed.setEntries( getEntries( dataEntries ) );

    log.debug( "Finished generating the feed \'{}\'.", title );
    
    return feed;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:21,代码来源:RssFeedGenerator.java

示例2: doGet

import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType("rss_2.0");
    feed.setTitle("WildFly-Camel Test RSS Feed");
    feed.setLink("http://localhost:8080/rss-tests");
    feed.setDescription("Test RSS feed for the camel-rss component");

    List<SyndEntry> entries = new ArrayList<>();
    for (int i = 1; i <= 5; i++) {
        entries.add(createFeedEntry("Test entry: ", "Test content: ", i));
    }
    feed.setEntries(entries);

    SyndFeedOutput output = new SyndFeedOutput();
    try {
        output.output(feed, response.getWriter());
    } catch (FeedException e) {
        throw new IllegalStateException("Error generating RSS feed", e);
    }
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:22,代码来源:RSSFeedServlet.java

示例3: main

import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
public static void main(String[] args) {
    boolean ok = false;
    if (args.length==2) {
        try {
            String outputType = args[0];
            URL feedUrl = new URL(args[1]);
            SyndFeedInput input = new SyndFeedInput();

            SyndFeed feed = input.build(new XmlReader(feedUrl));

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

            ok = true;
        }
        catch (Exception ex) {
            System.out.println("ERROR: "+ex.getMessage());
        }
    }

    if (!ok) {
        System.out.println();
        System.out.println("Converter converts between syndication feeds types.");
        System.out.println("The first parameter must be the feed type to convert to.");
        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 parameter must be the URL of the feed to convert.");
        System.out.println();
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:FeedConverter.java

示例4: rssFeed

import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
@RequestMapping("/rss")
public void rssFeed(HttpServletResponse response) throws IOException, FeedException {
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType("atom_1.0");
    feed.setEntries(new LinkedList());

    podcastEpisodeService.allPodcasts().forEach(podcastEpisode -> {
        feed.getEntries().add(podcastEpisode.getSyndEntry());
    });

    SyndFeedOutput output = new SyndFeedOutput();
    output.output(feed, response.getWriter());
}
 
开发者ID:DevWars,项目名称:devwars.tv,代码行数:14,代码来源:PodcastController.java

示例5: makeRSSFromRSSCorresponList

import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
/**
 * コレポンリストからRSSを生成する.
 * @param rssCorresponList コレポンリスト
 * @param baseURL BaseURL
 * @return RSS
 * @throws ServiceAbortException 設定値からRSSを出力する際に例外発生
 */
private String makeRSSFromRSSCorresponList(
    List<RSSCorrespon> rssCorresponList, String baseURL) throws ServiceAbortException {
    String resultRSS = null;

    SyndFeed feed = (SyndFeed) new SyndFeedImpl();
    feed.setFeedType(FEED_TYPE);
    feed.setTitle(RSS_TITLE);
    feed.setLink("");
    feed.setDescription("");
    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    if (rssCorresponList != null) {
        for (RSSCorrespon c : rssCorresponList) {
            entries.add(makeEntryFromRSSCorrespon(c, baseURL));
        }
    }
    feed.setEntries(entries);

    try {
        SyndFeedOutput output = new SyndFeedOutput();
        resultRSS = output.outputString(feed);
    } catch (FeedException e) {
        // 設定された値から生成されるXMLが異常だった際に発生. 起こり得ない.
        ServiceAbortException sae =
            new ServiceAbortException("RSS outputString error");
        sae.initCause(e);
        throw sae;
    }
    return resultRSS;
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:37,代码来源:RSSServiceImpl.java

示例6: createFeed

import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
/**
 * @param feedFile
 * @param seriesId
 * @param title
 * @param transcodingProfileId
 * @return
 */
public SyndFeed createFeed(File feedFile, String seriesId, String title,
    String transcodingProfileId) {
  final SyndFeed defaultFeed = new SyndFeedImpl();
  defaultFeed.setFeedType("rss_2.0");
  defaultFeed.setTitle(title);
  defaultFeed.setLink(this.applicationURL + PATH_SEPARATOR + transcodingProfileId
      + PATH_SEPARATOR + seriesId + feedFileExtension);
  defaultFeed.setDescription("Feed for the MythTV recordings of this program");

  File transformedFeedFile = null;
  try {
    final File feedDirectory = feedFile.getParentFile();
    if (!feedDirectory.exists()) {
      feedDirectory.mkdirs();
      LOGGER.info("Created feed directory: " + feedDirectory.getPath());
    }

    FileWriter writer = new FileWriter(feedFile);
    SyndFeedOutput output = new SyndFeedOutput();
    output.output(defaultFeed, writer);
    transformedFeedFile = this.generateTransformationFromFeed(feedFile, defaultFeed, seriesId);
    return defaultFeed;
  } catch (Exception e) {
    LOGGER.error("Error rendering feed", e);
    if (feedFile.canWrite()) {
      feedFile.delete();
    }

    if (transformedFeedFile != null && transformedFeedFile.canWrite()) {
      transformedFeedFile.delete();
    }
    return null;
  }
}
 
开发者ID:skidder,项目名称:mythpodcaster,代码行数:42,代码来源:FeedFileAccessorImpl.java

示例7: render

import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
/**
 * <p>render</p>
 *
 * @return a {@link java.lang.String} object.
 */
public String render() {
    SyndFeed feed = this.getFeed();
    feed.setFeedType(this.getFeedType());
    
    SyndFeedOutput output = new SyndFeedOutput();
    try {
        StringWriter writer = new StringWriter();
        output.output(feed, writer);
        return writer.toString();
    } catch (Throwable e) {
        log().warn("unable to render feed", e);
        return "";
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:20,代码来源:AbstractFeed.java

示例8: rss

import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
public String rss() throws IOException, FeedException {
    SyndFeed feed = new SyndFeedImpl();
    feed.setTitle("hiscores.shmup.com");
    feed.setFeedType("rss_2.0");
    feed.setDescription("hiscores.shmup.com");
    feed.setLink("http://hiscores.shmup.com");
    List entries = new ArrayList();
    feed.setEntries(entries);
    for (Score score : scores) {
        SyndEntry entry = new SyndEntryImpl();
        entry.setTitle(score.getGameTitle());
        entry.setAuthor(score.player.name);
        entry.setLink("http://hiscores.shmup.com/score/" + score.id);
        SyndContentImpl content = new SyndContentImpl();
        content.setValue(score.tweet());
        entry.setDescription(content);
        entry.setPublishedDate(score.getCreatedAt());
        entry.setUpdatedDate(score.getCreatedAt());
        SyndEnclosureImpl enclosure = new SyndEnclosureImpl();
        enclosure.setUrl(score.game.cover);
        enclosure.setType(score.game.getCoverType());
        entry.setEnclosures(Lists.newArrayList(enclosure));
        entries.add(entry);
    }
    Writer writer = new StringWriter();
    SyndFeedOutput output = new SyndFeedOutput();
    output.output(feed, writer);
    writer.close();
    Controller.response().setContentType("application/rss+xml");
    return writer.toString();
}
 
开发者ID:jsmadja,项目名称:shmuphiscores,代码行数:32,代码来源:Timeline.java

示例9: testSyndFeedNotEqual

import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
public void testSyndFeedNotEqual() throws Exception {
    SyndFeed feed1 = getCachedSyndFeed();
    SyndFeed feed2 = getSyndFeed();
    feed2.setFeedType("dummy");
    assertFalse(feed1.equals(feed2));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:7,代码来源:FeedOpsTest.java

示例10: main

import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
public static void main(String[] args) {
    boolean ok = false;
    if (args.length>=2) {
        try {
            String outputType = args[0];

            SyndFeed aggrFeed = new SyndFeedImpl();
            aggrFeed.setFeedType(outputType);

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

            List entries = new ArrayList();
            aggrFeed.setEntries(entries);

            for (int i=1;i<args.length;i++) {
                URL feedUrl = new URL(args[i]);
                SyndFeedInput input = new SyndFeedInput();

                SyndFeed feed = input.build(new XmlReader(feedUrl));

                entries.addAll(feed.getEntries());
            }

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

            ok = true;
        }
        catch (Exception ex) {
            System.out.println("ERROR: "+ex.getMessage());
        }
    }

    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:parabuild-ci,项目名称:parabuild-ci,代码行数:47,代码来源:FeedAggregator.java

示例11: generateBlogRssFeed

import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
public static Map<String, Object> generateBlogRssFeed(DispatchContext dctx, Map<String, ? extends Object> context) {
    GenericValue userLogin = (GenericValue) context.get("userLogin");
    String contentId = (String) context.get("blogContentId");
    String entryLink = (String) context.get("entryLink");
    String feedType = (String) context.get("feedType");
    Locale locale = (Locale) context.get("locale");

    // create the main link
    String mainLink = (String) context.get("mainLink");
    mainLink = mainLink + "?blogContentId=" + contentId;

    LocalDispatcher dispatcher = dctx.getDispatcher();
    Delegator delegator = dctx.getDelegator();

    // get the main blog content
    GenericValue content = null;
    try {
        content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne();
    } catch (GenericEntityException e) {
        Debug.logError(e, module);
    }

    if (content == null) {
        return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                "ContentCannotGenerateBlogRssFeed", 
                UtilMisc.toMap("contentId", contentId), locale));
    }

    // create the feed
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType(feedType);
    feed.setLink(mainLink);

    feed.setTitle(content.getString("contentName"));
    feed.setDescription(content.getString("description"));
    feed.setEntries(generateEntryList(dispatcher, delegator, contentId, entryLink, locale, userLogin));

    Map<String, Object> resp = ServiceUtil.returnSuccess();
    resp.put("wireFeed", feed.createWireFeed());
    return resp;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:42,代码来源:BlogRssServices.java

示例12: generateBlogRssFeed

import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
public static Map<String, Object> generateBlogRssFeed(DispatchContext dctx, Map<String, ? extends Object> context) {
    GenericValue userLogin = (GenericValue) context.get("userLogin");
    String contentId = (String) context.get("blogContentId");
    String entryLink = (String) context.get("entryLink");
    String feedType = (String) context.get("feedType");
    Locale locale = (Locale) context.get("locale");

    // create the main link
    String mainLink = (String) context.get("mainLink");
    mainLink = mainLink + "?blogContentId=" + contentId;

    LocalDispatcher dispatcher = dctx.getDispatcher();
    Delegator delegator = dctx.getDelegator();

    // get the main blog content
    GenericValue content = null;
    try {
        content = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false);
    } catch (GenericEntityException e) {
        Debug.logError(e, module);
    }

    if (content == null) {
        return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                "ContentCannotGenerateBlogRssFeed", 
                UtilMisc.toMap("contentId", contentId), locale));
    }

    // create the feed
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType(feedType);
    feed.setLink(mainLink);

    feed.setTitle(content.getString("contentName"));
    feed.setDescription(content.getString("description"));
    feed.setEntries(generateEntryList(dispatcher, delegator, contentId, entryLink, locale, userLogin));

    Map<String, Object> resp = ServiceUtil.returnSuccess();
    resp.put("wireFeed", feed.createWireFeed());
    return resp;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:42,代码来源:BlogRssServices.java


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