use of com.sun.syndication.io.SyndFeedOutput in project xwiki-platform by xwiki.
the class ActivityStreamImpl method getFeedOutput.
@Override
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 "";
}
}
use of com.sun.syndication.io.SyndFeedOutput in project xwiki-platform by xwiki.
the class FeedPlugin method getFeedOutput.
/**
* @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 "";
}
}
use of com.sun.syndication.io.SyndFeedOutput in project wildfly-camel by wildfly-extras.
the class RSSFeedServlet method doGet.
@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);
}
}
use of com.sun.syndication.io.SyndFeedOutput in project tutorials by eugenp.
the class RSSRomeExample method publishFeed.
private static void publishFeed(SyndFeed feed) throws IOException, FeedException {
Writer writer = new FileWriter("xyz.txt");
SyndFeedOutput syndFeedOutput = new SyndFeedOutput();
syndFeedOutput.output(feed, writer);
writer.close();
}
use of com.sun.syndication.io.SyndFeedOutput in project maven-plugins by apache.
the class FeedGenerator method export.
/**
* Extract a feed and export it to a Writer.
*
* @param releases the List of Releases. Only the last release is used in the feed.
* @param feedType The type of the feed to generate. See {@link #isSupportedFeedType(java.lang.String)} for
* supported values.
* @param writer a Writer. Note that this is not flushed nor closed upon exit.
* @throws IOException if an error occurs during export.
*/
public void export(final List<Release> releases, final String feedType, final Writer writer) throws IOException {
feed.setFeedType(feedType);
feed.setTitle(title);
feed.setAuthor(author);
feed.setPublishedDate(new Date());
feed.setLink(link);
feed.setDescription(rbundle.getString("report.changes.text.rssfeed.description"));
feed.setLanguage(rbundle.getLocale().getLanguage());
// feed.setCopyright( );
// feed.setEncoding();
feed.setEntries(getEntries(releases));
try {
new SyndFeedOutput().output(feed, writer);
} catch (FeedException ex) {
IOException ioex = new IOException(ex.getMessage());
ioex.initCause(ex);
throw ioex;
}
}
Aggregations