本文整理了Java中org.apache.abdera.model.Element.getDocument()
方法的一些代码示例,展示了Element.getDocument()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getDocument()
方法的具体详情如下:
包路径:org.apache.abdera.model.Element
类名称:Element
方法名:getDocument
[英]Returns the document to which this element belongs
[中]返回此元素所属的文档
代码示例来源:origin: org.apache.abdera/abdera-parser
public <T extends Element> Document<T> getDocument() {
Document<T> document = null;
if (parent != null) {
if (parent instanceof Element) {
document = ((Element)parent).getDocument();
} else if (parent instanceof Document) {
document = (Document<T>)parent;
}
}
return document;
}
代码示例来源:origin: org.apache.abdera/abdera-core
public <T extends Element> Document<T> getDocument() {
return internal.getDocument();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera
public <T extends Element> Document<T> getDocument() {
return internal.getDocument();
}
代码示例来源:origin: org.apache.abdera/abdera-server
@SuppressWarnings("unchecked")
private String getCharsetFromBase(Base base) {
if (base == null)
return null;
if (base instanceof Document) {
return ((Document)base).getCharset();
} else if (base instanceof Element) {
return getCharsetFromBase(((Element)base).getDocument());
}
return null;
}
代码示例来源:origin: org.apache.abdera/abdera-extensions-main
/**
* Attempt to guess the base direction using the charset encoding. This is a bit of a last resort approach
*/
@SuppressWarnings("unchecked")
public static <T extends Element> Direction guessDirectionFromEncoding(T element, boolean ignoredir) {
if (!ignoredir && hasDirection(element))
return getDirection(element);
Document doc = element.getDocument();
if (doc == null)
return Direction.UNSPECIFIED;
return Bidi.guessDirectionFromEncoding(doc.getCharset());
}
代码示例来源:origin: org.apache.abdera/abdera-core
public void writeTo(Base base, WritableByteChannel out, WriterOptions options) throws IOException {
String charset = options.getCharset();
if (charset == null) {
Document doc = null;
if (base instanceof Document)
doc = (Document)base;
else if (base instanceof Element) {
doc = ((Element)base).getDocument();
}
charset = doc != null ? doc.getCharset() : null;
}
writeTo(base, Channels.newWriter(out, charset != null ? charset : "utf-8"), options);
}
代码示例来源:origin: org.apache.abdera/abdera-parser
@SuppressWarnings("unchecked")
public void writeTo(Base base, OutputStream out, WriterOptions options) throws IOException {
out = getCompressedOutputStream(out, options);
String charset = options.getCharset();
if (charset == null) {
if (base instanceof Document)
charset = ((Document)base).getCharset();
else if (base instanceof Element) {
Document doc = ((Element)base).getDocument();
if (doc != null)
charset = doc.getCharset();
}
if (charset == null)
charset = "UTF-8";
} else {
Document doc = null;
if (base instanceof Document)
doc = (Document)base;
else if (base instanceof Element)
doc = ((Element)base).getDocument();
if (doc != null)
doc.setCharset(charset);
}
base.writeTo(new OutputStreamWriter(out, charset));
finishCompressedOutputStream(out, options);
if (options.getAutoClose())
out.close();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera
public void writeTo(
Base base,
WritableByteChannel out,
WriterOptions options)
throws IOException {
String charset = options.getCharset();
if (charset == null) {
Document doc = null;
if (base instanceof Document)
doc = (Document) base;
else if (base instanceof Element) {
doc = ((Element)base).getDocument();
}
charset = doc != null ? doc.getCharset() : null;
}
writeTo(
base,
Channels.newWriter(
out, charset != null ?
charset :
"utf-8"),
options);
}
代码示例来源:origin: org.apache.abdera/abdera-core
} else if (base instanceof Element) {
Element el = (Element)base;
if (el.getDocument() != null) {
MimeType mt = el.getDocument().getContentType();
type = (mt != null) ? mt.toString() : null;
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera
} else if (base instanceof Element) {
Element el = (Element)base;
if (el.getDocument() != null) {
MimeType mt = el.getDocument().getContentType();
type = (mt != null) ? mt.toString() : null;
代码示例来源:origin: org.apache.abdera/abdera-server
/**
* Return a document
*/
@SuppressWarnings("unchecked")
public static ResponseContext returnBase(Base base, int status, Date lastModified) {
log.debug(Localizer.get("RETURNING.DOCUMENT"));
BaseResponseContext response = new BaseResponseContext(base);
response.setStatus(status);
if (lastModified != null)
response.setLastModified(lastModified);
// response.setContentType(MimeTypeHelper.getMimeType(base));
Document doc = base instanceof Document ? (Document)base : ((Element)base).getDocument();
if (doc.getEntityTag() != null) {
response.setEntityTag(doc.getEntityTag());
} else if (doc.getLastModified() != null) {
response.setLastModified(doc.getLastModified());
}
return response;
}
代码示例来源:origin: org.apache.abdera/abdera-security
private Document<Element> signDocument(Abdera abdera, Document<Element> doc) throws SecurityException {
AbderaSecurity security = new AbderaSecurity(abdera);
if (signingKey == null || cert == null)
return doc; // pass through
Signature sig = security.getSignature();
SignatureOptions options = sig.getDefaultSignatureOptions();
options.setCertificate(cert);
options.setSigningKey(signingKey);
if (algorithm != null)
options.setSigningAlgorithm(algorithm);
Element element = doc.getRoot();
element = sig.sign(element, options);
return element.getDocument();
}
内容来源于网络,如有侵权,请联系作者删除!