Search in sources :

Example 1 with SyndFeedOutput

use of com.rometools.rome.io.SyndFeedOutput in project asterixdb by apache.

the class RSSFeedServlet method get.

@Override
protected void get(IServletRequest req, IServletResponse res) throws IOException {
    try {
        SyndFeed feed = getFeed(req);
        String feedType = req.getParameter(FEED_TYPE);
        feedType = (feedType != null) ? feedType : defaultFeedType;
        feed.setFeedType(feedType);
        HttpUtil.setContentType(res, MIME_TYPE);
        SyndFeedOutput output = new SyndFeedOutput();
        output.output(feed, res.writer());
    } catch (FeedException | ParseException ex) {
        GlobalConfig.ASTERIX_LOGGER.log(Level.WARNING, ex.getMessage(), ex);
        String msg = COULD_NOT_GENERATE_FEED_ERROR;
        res.writer().print(msg);
        res.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
    }
}
Also used : SyndFeed(com.rometools.rome.feed.synd.SyndFeed) FeedException(com.rometools.rome.io.FeedException) SyndFeedOutput(com.rometools.rome.io.SyndFeedOutput) ParseException(java.text.ParseException)

Aggregations

SyndFeed (com.rometools.rome.feed.synd.SyndFeed)1 FeedException (com.rometools.rome.io.FeedException)1 SyndFeedOutput (com.rometools.rome.io.SyndFeedOutput)1 ParseException (java.text.ParseException)1