Package com.sun.syndication.io

Examples of com.sun.syndication.io.SyndFeedOutput


      resp.sendError(HttpServletResponse.SC_NOT_FOUND);
      return;
    }
    feed.setFeedType(feedType);
    resp.setContentType("application/xml; charset=utf-8");
    SyndFeedOutput output = new SyndFeedOutput();
    try {
      output.output(feed, resp.getWriter());
    } catch (FeedException ex) {
      resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not generate feed");
    }
  }
View Full Code Here


     */
    private static Feed atomFeed(SyndFeed syndFeed) {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
       
        syndFeed.setFeedType("atom_1.0");
        SyndFeedOutput syndOutput = new SyndFeedOutput();
        try {
            syndOutput.output(syndFeed, new OutputStreamWriter(bos));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        Parser parser = Abdera.getNewParser();
        Document<Feed> document = parser.parse(new ByteArrayInputStream(bos.toByteArray()));
View Full Code Here

            else if ( ( groupId != null ) && ( artifactId != null ) )
            {
                feed.setLink( req.getRequestURL().toString() );
            }

            SyndFeedOutput output = new SyndFeedOutput();
            output.output( feed, res.getWriter() );
        }
        catch ( UserNotFoundException unfe )
        {
            log.debug( COULD_NOT_AUTHENTICATE_USER, unfe );
            res.sendError( HttpServletResponse.SC_UNAUTHORIZED, COULD_NOT_AUTHENTICATE_USER );
View Full Code Here

                    // Convert to an RSS feed
                    response.setContentType("application/rss+xml; charset=utf-8");
                    feed.setFeedType("atom_1.0");
                    SyndFeed syndFeed = new SyndFeedImpl(feed);
                    syndFeed.setFeedType(requestFeedType);
                    SyndFeedOutput syndOutput = new SyndFeedOutput();
                    try {
                        OutputStream output = response.getOutputStream();
                        syndOutput.output(syndFeed, new PrintWriter(output));
                    } catch (FeedException e) {
                        throw new ServletException(e);
                    }
                } else {
                    response.sendError(HttpServletResponse.SC_NOT_FOUND);
View Full Code Here

            entries.add(entry);
        }

        feed.setEntries(entries);

        final SyndFeedOutput syndFeedOutput = new SyndFeedOutput();

        return new StreamingOutput() {
            public void write(OutputStream output) throws IOException, WebApplicationException {
                Writer writer = new OutputStreamWriter(output);
                try {
                    syndFeedOutput.output(feed, writer, true);
                } catch (FeedException e) { // TODO: log me
                    throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
                }
            }
        };
View Full Code Here

                logger.debug("Found object on stack with expression '" + feedName + "': " + feed);

            if (feedType != null) // if the feedType is specified, we'll override the one set in the feed object
                feed.setFeedType(feedType);

            SyndFeedOutput output = new SyndFeedOutput();
            // we'll need the writer since Rome doesn't support writing to an outputStream yet
            Writer out = null;
            try {
                out = ServletActionContext.getResponse().getWriter();
                output.output(feed, out);
            } catch (Exception e) {
                // Woops, couldn't write the feed ?
                logger.error("Could not write the feed: " + e.getMessage(), e);
            } finally {
                // close the output writer (will flush automatically)
View Full Code Here

            try
            {
                URL feedUrl = new URL(url);
                SyndFeedInput input = new SyndFeedInput();
                SyndFeed feed = input.build(new XmlReader(feedUrl));
                SyndFeedOutput output = new SyndFeedOutput();           
                //output.output(feed, response.getWriter());
                Document document = output.outputW3CDom(feed);
   
                Map parameters = new HashMap();
               
                parameters.put("itemdisplayed", prefs.getValue("itemdisplayed", "15"));
                parameters.put("openinpopup", prefs.getValue("openinpopup", "true"));
View Full Code Here

    public Document outputW3CDom()
        throws FeedException
    {
        try
        {
            SyndFeedOutput feedWriter = new SyndFeedOutput();
            return feedWriter.outputW3CDom(feed);
        }
        catch (FeedException e)
        {
            log.error(e);
            throw e;
View Full Code Here

     * @return the feed we built as serialized XML string
     */
    public String outputString()
        throws FeedException
    {
        SyndFeedOutput feedWriter = new SyndFeedOutput();
        return feedWriter.outputString(feed);
    }
View Full Code Here

     * send the output to designated Writer
     */
    public void output(java.io.Writer writer)
        throws FeedException, IOException
    {
        SyndFeedOutput feedWriter = new SyndFeedOutput();
        feedWriter.output(feed, writer);
    }
View Full Code Here

TOP

Related Classes of com.sun.syndication.io.SyndFeedOutput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.