Package com.sun.syndication.io

Examples of com.sun.syndication.io.WireFeedOutput


      Charset wireFeedCharset = Charset.forName(wireFeedEncoding);
      contentType = new MediaType(contentType.getType(), contentType.getSubtype(), wireFeedCharset);
      outputMessage.getHeaders().setContentType(contentType);
    }

    WireFeedOutput feedOutput = new WireFeedOutput();

    try {
      Writer writer = new OutputStreamWriter(outputMessage.getBody(), wireFeedEncoding);
      feedOutput.output(wireFeed, writer);
    }
    catch (FeedException ex) {
      throw new HttpMessageNotWritableException("Could not write WiredFeed: " + ex.getMessage(), ex);
    }
  }
View Full Code Here


    response.setContentType(getContentType());
    if (!StringUtils.hasText(wireFeed.getEncoding())) {
      wireFeed.setEncoding("UTF-8");
    }

    WireFeedOutput feedOutput = new WireFeedOutput();
    ServletOutputStream out = response.getOutputStream();
    feedOutput.output(wireFeed, new OutputStreamWriter(out, wireFeed.getEncoding()));
    out.flush();
  }
View Full Code Here

                }
                else if (handler.isCollectionURI(pathInfo)) {
                    // return a collection
                    Feed col = handler.getCollection(pathInfo);
                    col.setFeedType(FEED_TYPE);
                    WireFeedOutput wireFeedOutput = new WireFeedOutput();
                    Document feedDoc = wireFeedOutput.outputJDom(col);
                    res.setContentType("application/atom+xml; charset=utf-8");
                    Writer writer = res.getWriter();
                    XMLOutputter outputter = new XMLOutputter();
                    outputter.setFormat(Format.getPrettyFormat());
                    outputter.output(feedDoc, writer);
View Full Code Here

        Feed feed1 = new Feed();
        feed1.setFeedType(AtomServlet.FEED_TYPE);
        feed1.setEntries(entries);
       
        // Get Rome to output feed as a JDOM document
        WireFeedOutput wireFeedOutput = new WireFeedOutput();
        Document feedDoc = wireFeedOutput.outputJDom(feed1);
       
        // Grab entry element from feed and get JDOM to serialize it
        Element entryElement= (Element)feedDoc.getRootElement().getChildren().get(0);
       
        // Add our own namespaced element, so we can determine if we can
View Full Code Here

        fetchedEntryElement.detach();
       
        // Put entry into a JDOM document with 'feed' root so that Rome can handle it
        Feed feed = new Feed();
        feed.setFeedType(FEED_TYPE);
        WireFeedOutput wireFeedOutput = new WireFeedOutput();
        Document feedDoc = wireFeedOutput.outputJDom(feed);
        feedDoc.getRootElement().addContent(fetchedEntryElement);
       
        // Check for our special namespaced element. If it's there, then we
        // know that client is not preserving foreign markup.
        Namespace ns = Namespace.getNamespace(
View Full Code Here

     * Creates a SyndFeedOutput instance.
     * <p>
     *
     */
    public SyndFeedOutput() {
        _feedOutput = new WireFeedOutput();
    }
View Full Code Here

        content.setValue("hello");
        item.setContent(content);
        channel.getItems().add(item);

        StringWriter sw = new StringWriter();
        WireFeedOutput output = new WireFeedOutput();
        output.output(channel, sw);
        sw.close();

        return sw.toString();
    }
View Full Code Here

    public void testReadWrite() throws Exception {
        Reader r = new StringReader(createFeed());
        WireFeedInput input = new WireFeedInput();
        Channel channel = (Channel) input.build(r);
        StringWriter sw = new StringWriter();
        WireFeedOutput output = new WireFeedOutput();
        output.output(channel, sw);
        sw.close();
        r = new StringReader(sw.toString());
        channel = (Channel) input.build(r);
        sw = new StringWriter();
        output.output(channel, sw);
        sw.close();
        System.out.println(sw);
    }
View Full Code Here

    }

    public void testReadWrite() throws Exception {
        Feed feed = createFeed();
        StringWriter sw = new StringWriter();
        WireFeedOutput output = new WireFeedOutput();
        output.output(feed, sw);
        sw.close();
        StringReader reader = new StringReader(sw.toString());
        WireFeedInput input = new WireFeedInput();
        feed = (Feed) input.build(reader);
        reader.close();
View Full Code Here

    }

    public void testXML() throws Exception {
        Feed feed = createFeed();
        StringWriter sw = new StringWriter();
        WireFeedOutput output = new WireFeedOutput();
        output.output(feed, sw);
        sw.close();
        assertTrue(sw.toString().contains("<test xmlns=\"\">Hello Hello</test>"));
    }
View Full Code Here

TOP

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

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.