data.feed.setFeedType( "rss_2.0" ); } else { data.feed.setFeedType( meta.getVersion() );
/** * Sets the feed type for XML delivery, e.g. "rss_1.0", "atom_1.0" * Must match one of ROME's configured generators, see rome.properties * (currently rss_1.0, rss_2.0, atom_1.0, atom_0.3) * * @param feedType feed type */ public void setType(String feedType) { feed.setFeedType(feedType); // XXX FIXME: workaround ROME 1.0 bug, it puts invalid image element in rss1.0 if ("rss_1.0".equals(feedType)) { feed.setImage(null); } }
private void doWrite(SyndFeed feed) throws IOException, FeedException { feed.setFeedType(feedType.value); SyndFeedOutput output = new SyndFeedOutput(); output.output(feed, response.getWriter()); response.getWriter().close(); } }
/** * {@inheritDoc} */ public String getFeedOutput(SyndFeed feed, String type) { feed.setFeedType(type); StringWriter writer = new StringWriter(); SyndFeedOutput output = new SyndFeedOutput(); try { output.output(feed, writer); writer.close(); return writer.toString(); } catch (Exception e) { return ""; } }
/** * @see FeedPluginApi#getFeedOutput(SyndFeed, String) */ public String getFeedOutput(SyndFeed feed, String type, XWikiContext context) { feed.setFeedType(type); StringWriter writer = new StringWriter(); SyndFeedOutput output = new SyndFeedOutput(); try { output.output(feed, writer); writer.close(); return writer.toString(); } catch (Exception e) { e.printStackTrace(); return ""; } }
@Override public Representation toRepresentation(Object source, Variant target, Resource resource) throws IOException { if (source instanceof SyndFeed) { SyndFeed feed = (SyndFeed) source; if (feed.getFeedType() == null) { if (VARIANT_APPLICATION_RSS.isCompatible(target)) { feed.setFeedType("rss_2.0"); } else { feed.setFeedType("atom_1.0"); } } return new SyndFeedRepresentation(feed); } return null; }
@Override public void write(Writer writer) throws IOException { try { SyndFeedOutput output = new SyndFeedOutput(); if (this.feed.getFeedType() == null) { this.feed.setFeedType("atom_1.0"); } output.output(this.feed, writer); } catch (FeedException e) { IOException ioe = new IOException("Feed exception"); ioe.initCause(e); throw ioe; } } }
public static SyndFeed createFeed(Device device) { final SyndFeed feed = new SyndFeedImpl(); feed.setFeedType(ATOMFeedType.ATOM_10.getFeedType()); feed.setEncoding("UTF-8"); return feed; }
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; }
public static void writeFeed(SyndFeed feed, FeedType feedType, Writer outputWriter) throws FeedException, IOException { try { feed.setFeedType(feedType.getType()); SyndFeedOutput output = new SyndFeedOutput(); output.output(feed, outputWriter); } catch (FeedException ex) { ex.printStackTrace(); } }
feed.setFeedType(outputType);
feed.setFeedType(outputType);
/** * Constructs a feed. * * @param feedType * The feed type (see ROME documentation) * @param entries * The list of entries * @param characterSet * The character set */ public SyndFeedRepresentation(String feedType, List<?> entries, CharacterSet characterSet) { super(getMediaType(feedType)); setCharacterSet(characterSet); this.feed = new SyndFeedImpl(); this.feed.setFeedType(feedType); this.feed.setEntries(entries); }
feed.setFeedType(getFeedType(request)); response.setContentType(MIME_TYPE); SyndFeedOutput output = new SyndFeedOutput();
feed.setFeedType("atom_1.0"); feed.setTitle("Scoold - Recent questions"); feed.setLink(baseurl);
feed.setFeedType(feedType); feed.setLink(mainLink);
feed.setFeedType(ATOM_1_0); feed.setFeedType(RSS_2_0);
SyndFeed feed = new SyndFeedImpl(); feed.setFeedType(feedType); // Add the opensearch module, you would get information like totalResults from the // return results of your search List mods = feed.getModules(); OpenSearchModule osm = new OpenSearchModuleImpl(); osm.setItemsPerPage(1); osm.setStartIndex(1); osm.setTotalResults(1024); osm.setItemsPerPage(50); OSQuery query = new OSQuery(); query.setRole("superset"); query.setSearchTerms("Java Syndication"); query.setStartPage(1); osm.addQuery(query); Link link = new Link(); link.setHref("http://www.bargainstriker.com/opensearch-description.xml"); link.setType("application/opensearchdescription+xml"); osm.setLink(link); mods.add(osm); feed.setModules(mods); // end add module