org.apache.abdera.model.Element.getResolvedBaseUri()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(291)

本文整理了Java中org.apache.abdera.model.Element.getResolvedBaseUri()方法的一些代码示例,展示了Element.getResolvedBaseUri()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getResolvedBaseUri()方法的具体详情如下:
包路径:org.apache.abdera.model.Element
类名称:Element
方法名:getResolvedBaseUri

Element.getResolvedBaseUri介绍

[英]Returns the current in-scope, fully qualified Base URI for this element.
[中]返回此元素的当前范围内的完全限定基URI。

代码示例

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera

  1. public IRI getResolvedBaseUri() {
  2. return internal.getResolvedBaseUri();
  3. }

代码示例来源:origin: org.apache.abdera/abdera-core

  1. public IRI getResolvedBaseUri() {
  2. return internal.getResolvedBaseUri();
  3. }

代码示例来源:origin: org.apache.abdera/abdera-extensions-json

  1. private static boolean isSameAsParentBase(Element element) {
  2. IRI parentbase = null;
  3. if (element.getParentElement() != null) {
  4. parentbase =
  5. element instanceof Document ? ((Document)element).getBaseUri() : ((Element)element)
  6. .getResolvedBaseUri();
  7. }
  8. IRI base = element.getResolvedBaseUri();
  9. if (parentbase == null && base != null) {
  10. return false;
  11. }
  12. if (parentbase == null && base == null) {
  13. return true;
  14. }
  15. return parentbase.equals(element.getResolvedBaseUri());
  16. }

代码示例来源:origin: org.apache.abdera/abdera-security

  1. private boolean _verify(Element element, SignatureOptions options) throws XMLSignatureException,
  2. XMLSecurityException {
  3. boolean answer = false;
  4. org.w3c.dom.Element dom = fomToDom((Element)element, options);
  5. NodeList children = dom.getChildNodes();
  6. for (int n = 0; n < children.getLength(); n++) {
  7. Node node = children.item(n);
  8. if (node.getNodeType() == Node.ELEMENT_NODE) {
  9. org.w3c.dom.Element el = (org.w3c.dom.Element)node;
  10. if (Constants.DSIG_NS.equals(el.getNamespaceURI()) && Constants.LN_SIGNATURE.equals(el.getLocalName())) {
  11. IRI baseUri = element.getResolvedBaseUri();
  12. XMLSignature sig = new XMLSignature(el, (baseUri != null) ? baseUri.toString() : "");
  13. answer = is_valid_signature(sig, options);
  14. }
  15. }
  16. }
  17. return answer;
  18. }

代码示例来源:origin: org.apache.abdera/abdera-security

  1. public <T extends Element> KeyInfo getSignatureKeyInfo(T element, SignatureOptions options)
  2. throws SecurityException {
  3. KeyInfo ki = null;
  4. org.w3c.dom.Element dom = fomToDom((Element)element, options);
  5. NodeList children = dom.getChildNodes();
  6. for (int n = 0; n < children.getLength(); n++) {
  7. try {
  8. Node node = children.item(n);
  9. if (node.getNodeType() == Node.ELEMENT_NODE) {
  10. org.w3c.dom.Element el = (org.w3c.dom.Element)node;
  11. if (Constants.DSIG_NS.equals(el.getNamespaceURI()) && Constants.LN_SIGNATURE.equals(el
  12. .getLocalName())) {
  13. IRI baseUri = element.getResolvedBaseUri();
  14. XMLSignature sig = new XMLSignature(el, (baseUri != null) ? baseUri.toString() : "");
  15. ki = sig.getKeyInfo();
  16. }
  17. }
  18. } catch (Exception e) {
  19. }
  20. }
  21. return ki;
  22. }

代码示例来源:origin: org.apache.abdera/abdera-security

  1. @SuppressWarnings("unchecked")
  2. public <T extends Element> T removeInvalidSignatures(T element, SignatureOptions options) throws SecurityException {
  3. List<org.w3c.dom.Element> remove = new ArrayList<org.w3c.dom.Element>();
  4. org.w3c.dom.Element dom = fomToDom((Element)element, options);
  5. NodeList children = dom.getChildNodes();
  6. for (int n = 0; n < children.getLength(); n++) {
  7. try {
  8. Node node = children.item(n);
  9. if (node.getNodeType() == Node.ELEMENT_NODE) {
  10. org.w3c.dom.Element el = (org.w3c.dom.Element)node;
  11. if (Constants.DSIG_NS.equals(el.getNamespaceURI()) && Constants.LN_SIGNATURE.equals(el
  12. .getLocalName())) {
  13. IRI baseUri = element.getResolvedBaseUri();
  14. XMLSignature sig = new XMLSignature(el, (baseUri != null) ? baseUri.toString() : "");
  15. if (!is_valid_signature(sig, options)) {
  16. remove.add(el);
  17. }
  18. }
  19. }
  20. } catch (Exception e) {
  21. }
  22. }
  23. for (org.w3c.dom.Element el : remove)
  24. dom.removeChild(el);
  25. return (T)domToFom(dom, options);
  26. }

代码示例来源:origin: org.apache.abdera/abdera-security

  1. private <T extends Element> X509Certificate[] _getcerts(T element, SignatureOptions options)
  2. throws XMLSignatureException, XMLSecurityException {
  3. List<X509Certificate> certs = new ArrayList<X509Certificate>();
  4. org.w3c.dom.Element dom = fomToDom((Element)element, options);
  5. NodeList children = dom.getChildNodes();
  6. for (int n = 0; n < children.getLength(); n++) {
  7. try {
  8. Node node = children.item(n);
  9. if (node.getNodeType() == Node.ELEMENT_NODE) {
  10. org.w3c.dom.Element el = (org.w3c.dom.Element)node;
  11. if (Constants.DSIG_NS.equals(el.getNamespaceURI()) && Constants.LN_SIGNATURE.equals(el
  12. .getLocalName())) {
  13. IRI baseUri = element.getResolvedBaseUri();
  14. XMLSignature sig = new XMLSignature(el, (baseUri != null) ? baseUri.toString() : "");
  15. if (is_valid_signature(sig, options)) {
  16. KeyInfo ki = sig.getKeyInfo();
  17. if (ki != null) {
  18. X509Certificate cert = ki.getX509Certificate();
  19. if (cert != null)
  20. certs.add(cert);
  21. }
  22. }
  23. }
  24. }
  25. } catch (Exception e) {
  26. }
  27. }
  28. return certs.toArray(new X509Certificate[certs.size()]);
  29. }

代码示例来源:origin: org.apache.abdera/abdera-parser

  1. public IRI getResolvedBaseUri() {
  2. IRI baseUri = null;
  3. IRI uri = _getUriValue(getAttributeValue(BASE));
  4. if (IRIHelper.isJavascriptUri(uri) || IRIHelper.isMailtoUri(uri)) {
  5. uri = null;
  6. }
  7. if (parent instanceof Element)
  8. baseUri = ((Element)parent).getResolvedBaseUri();
  9. else if (parent instanceof Document)
  10. baseUri = ((Document)parent).getBaseUri();
  11. if (uri != null && baseUri != null) {
  12. uri = baseUri.resolve(uri);
  13. } else if (uri == null) {
  14. uri = baseUri;
  15. }
  16. return uri;
  17. }

代码示例来源:origin: org.apache.abdera/abdera-extensions-json

  1. jstream.writeField("xml:base", child.getResolvedBaseUri());
  2. writeLanguageFields(child, jstream);
  3. for (QName attr : attributes) {
  4. if (val != null && ("href".equalsIgnoreCase(name) || "src".equalsIgnoreCase(name) || "action"
  5. .equalsIgnoreCase(name))) {
  6. IRI base = child.getResolvedBaseUri();
  7. if (base != null)
  8. val = base.resolve(val).toASCIIString();

代码示例来源:origin: org.apache.abdera/abdera-security

  1. @SuppressWarnings("unchecked")
  2. private <T extends Element> T _sign(T element, SignatureOptions options) throws XMLSecurityException {
  3. element.setBaseUri(element.getResolvedBaseUri());
  4. org.w3c.dom.Element dom = fomToDom((Element)element.clone(), options);
  5. org.w3c.dom.Document domdoc = dom.getOwnerDocument();
  6. X509Certificate cert = options.getCertificate();
  7. PublicKey pkey = options.getPublicKey();
  8. IRI baseUri = element.getResolvedBaseUri();
  9. XMLSignature sig =
  10. new XMLSignature(domdoc, (baseUri != null) ? baseUri.toString() : "", options.getSigningAlgorithm());

代码示例来源:origin: org.apache.abdera/abdera-extensions-json

  1. writeLanguageFields(element, jstream);
  2. if (!isSameAsParentBase(element)) {
  3. jstream.writeField("xml:base", element.getResolvedBaseUri());
  4. jstream.writeField("xml:base", element.getResolvedBaseUri());
  5. writeLanguageFields(content, jstream);
  6. jstream.writeField("src", content.getResolvedSrc());
  7. writeLanguageFields(element, jstream);
  8. if (!isSameAsParentBase(element))
  9. jstream.writeField("xml:base", element.getResolvedBaseUri());
  10. Categories categories = (Categories)element;
  11. jstream.writeField("fixed", categories.isFixed() ? "true" : "false");
  12. writeLanguageFields(element, jstream);
  13. if (!isSameAsParentBase(element))
  14. jstream.writeField("xml:base", element.getResolvedBaseUri());
  15. Category category = (Category)element;
  16. jstream.writeField("term", category.getTerm());
  17. writeLanguageFields(element, jstream);
  18. if (!isSameAsParentBase(element))
  19. jstream.writeField("xml:base", element.getResolvedBaseUri());
  20. Collection collection = (Collection)element;
  21. jstream.writeField("href", collection.getResolvedHref());
  22. writeLanguageFields(element, jstream);
  23. if (!isSameAsParentBase(element)) {
  24. jstream.writeField("xml:base", element.getResolvedBaseUri());

相关文章