public void writeTo(OutputStream out) throws IOException { out = wrap(out); super.writeTo(out); out.flush(); } }
public void writeTo(OutputStream out, Writer writer) throws IOException { out = wrap(out); super.writeTo(out, writer); out.flush(); }
private void sign(OutputStream aout, Writer writer) throws Exception { Document<Element> doc = null; try { ByteArrayOutputStream out = new ByteArrayOutputStream(); if (writer == null) super.writeTo(out); else super.writeTo(out, writer); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); doc = abdera.getParser().parse(in); } catch (Exception e) { } if (doc != null) { doc = signDocument(abdera, doc); doc.writeTo(aout); } else { super.writeTo(aout); } } }
private void toJson(OutputStream aout, Writer writer) throws Exception { Document<Element> doc = null; try { ByteArrayOutputStream out = new ByteArrayOutputStream(); if (writer == null) super.writeTo(out); else super.writeTo(out, writer); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); doc = abdera.getParser().parse(in); } catch (Exception e) { } if (doc != null) { doc.writeTo("json", aout); } else { throw new RuntimeException("There was an error serializing the entry to JSON"); } } }
private void encrypt(OutputStream aout, Writer writer) throws Exception { Document<Element> doc = null; try { ByteArrayOutputStream out = new ByteArrayOutputStream(); if (writer == null) super.writeTo(out); else super.writeTo(out, writer); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); doc = abdera.getParser().parse(in); } catch (Exception e) { } if (doc != null) { Encryption enc = security.getEncryption(); EncryptionOptions options = initEncryptionOptions(request, response, enc, arg); doc = enc.encrypt(doc, options); } if (doc != null) doc.writeTo(aout); else throw new RuntimeException("There was an error encrypting the response"); } }