Package com.rometools.rome.io

Examples of com.rometools.rome.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 WireFeed: " + ex.getMessage(), ex);
    }
  }
View Full Code Here


    setResponseContentType(request, response);
    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

  @UnitOfWork
  @Produces(MediaType.APPLICATION_XML)
  @ApiOperation(value = "OPML export", notes = "Export an OPML file of the user's subscriptions")
  public Response exportOpml(@SecurityCheck User user) {
    Opml opml = opmlExporter.export(user);
    WireFeedOutput output = new WireFeedOutput();
    String opmlString = null;
    try {
      opmlString = output.outputString(opml);
    } catch (Exception e) {
      return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e).build();
    }
    return Response.ok(opmlString).build();
  }
View Full Code Here

        // Put entry into a JDOM document with 'feed' root so that Rome can
        // handle it
        final Feed feed = new Feed();
        feed.setFeedType("atom_1.0");
        final WireFeedOutput wireFeedOutput = new WireFeedOutput();
        final Document feedDoc = wireFeedOutput.outputJDom(feed);
        feedDoc.getRootElement().addContent(fetchedEntryElement);

        if (baseURI != null) {
            feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
        }
View Full Code Here

        final Feed feed1 = new Feed();
        feed1.setFeedType("atom_1.0");
        feed1.setEntries(entries);

        // Get Rome to output feed as a JDOM document
        final WireFeedOutput wireFeedOutput = new WireFeedOutput();
        final Document feedDoc = wireFeedOutput.outputJDom(feed1);

        // Grab entry element from feed and get JDOM to serialize it
        final Element entryElement = feedDoc.getRootElement().getChildren().get(0);

        final XMLOutputter outputter = new XMLOutputter();
View Full Code Here

    }

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

    }

    public void testXML() throws Exception {
        final Feed feed = createFeed();
        final StringWriter sw = new StringWriter();
        final 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.rometools.rome.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.