本文整理了Java中org.apache.abdera.model.Document.writeTo()
方法的一些代码示例,展示了Document.writeTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.writeTo()
方法的具体详情如下:
包路径:org.apache.abdera.model.Document
类名称:Document
方法名:writeTo
暂无
代码示例来源:origin: org.apache.abdera/abdera-security
protected org.w3c.dom.Document fomToDom(Document doc, SecurityOptions options) {
org.w3c.dom.Document dom = null;
if (doc != null) {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
doc.writeTo(out);
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(false);
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
dom = db.parse(in);
} catch (Exception e) {
}
}
return dom;
}
代码示例来源:origin: org.apache.abdera/abdera-extensions-json
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");
}
}
}
代码示例来源:origin: org.apache.abdera/abdera-security
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);
}
}
}
代码示例来源:origin: org.apache.abdera/abdera-security
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");
}
}
代码示例来源:origin: org.apache.abdera/abdera-extensions-json
response.setDateHeader("Last-Modified", doc.getLastModified().getTime());
OutputStream out = response.getOutputStream();
doc.writeTo("json", out);
} catch (Exception e) {
response.sendError(500);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-atom-runtime
service.getDocument().writeTo(response.getOutputStream());
} catch (IOException ioe) {
throw new ServletException(ioe);
feed.getDocument().writeTo(response.getOutputStream());
} catch (IOException ioe) {
throw new ServletException(ioe);
内容来源于网络,如有侵权,请联系作者删除!