本文整理汇总了Java中javax.xml.crypto.dom.DOMURIReference类的典型用法代码示例。如果您正苦于以下问题:Java DOMURIReference类的具体用法?Java DOMURIReference怎么用?Java DOMURIReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DOMURIReference类属于javax.xml.crypto.dom包,在下文中一共展示了DOMURIReference类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dereference
import javax.xml.crypto.dom.DOMURIReference; //导入依赖的package包/类
public Data dereference(URIReference uriReference, XMLCryptoContext context) throws URIReferenceException {
if (uriReference == null) {
throw new NullPointerException("Parameter 'uriReference' cannot be null.");
}
if (context == null) {
throw new NullPointerException("Parameter 'context' can notbe null.");
}
if (!(uriReference instanceof DOMURIReference && context instanceof DOMCryptoContext)) {
throw new IllegalArgumentException(String.format("This %s implementation supports the DOM XML mechanism only.",
URIDereferencer.class.getName()));
}
String uriString = uriReference.getURI();
if (uriString == null) {
throw new URIReferenceException("Cannot resolve a URI of value 'null'.");
}
if (uriString != null && ((uriString.length() != 0 && uriString.charAt(0) == '#') || uriString.isEmpty())) {
// same document uri
XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
return fac.getURIDereferencer().dereference(uriReference, context);
}
throw new URIReferenceException(String.format("URI reference %s not supported", uriString));
}