本文整理汇总了Java中org.apache.xml.security.utils.resolver.ResourceResolverException类的典型用法代码示例。如果您正苦于以下问题:Java ResourceResolverException类的具体用法?Java ResourceResolverException怎么用?Java ResourceResolverException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourceResolverException类属于org.apache.xml.security.utils.resolver包,在下文中一共展示了ResourceResolverException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: engineResolveURI
import org.apache.xml.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
/**
* @inheritDoc
*/
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
throws ResourceResolverException {
try {
// calculate new URI
URI uriNew = getNewURI(context.uriToResolve, context.baseUri);
String fileName =
ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
FileInputStream inputStream = new FileInputStream(fileName);
XMLSignatureInput result = new XMLSignatureInput(inputStream);
result.setSecureValidation(context.secureValidation);
result.setSourceURI(uriNew.toString());
return result;
} catch (Exception e) {
throw new ResourceResolverException(e, context.uriToResolve, context.baseUri, "generic.EmptyMessage");
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:24,代码来源:ResolverLocalFilesystem.java
示例2: getContentsBeforeTransformation
import org.apache.xml.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
/**
* Returns the XMLSignatureInput which is created by de-referencing the URI attribute.
* @return the XMLSignatureInput of the source of this reference
* @throws ReferenceNotInitializedException If the resolver found any
* problem resolving the reference
*/
public XMLSignatureInput getContentsBeforeTransformation()
throws ReferenceNotInitializedException {
try {
Attr uriAttr =
getElement().getAttributeNodeNS(null, Constants._ATT_URI);
ResourceResolver resolver =
ResourceResolver.getInstance(
uriAttr, this.baseURI, this.manifest.getPerManifestResolvers(), secureValidation
);
resolver.addProperties(this.manifest.getResolverProperties());
return resolver.resolve(uriAttr, this.baseURI, secureValidation);
} catch (ResourceResolverException ex) {
throw new ReferenceNotInitializedException(ex);
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:24,代码来源:Reference.java
示例3: testProxyAuthWithWrongPassword
import org.apache.xml.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
@Test
@Ignore
public void testProxyAuthWithWrongPassword() throws Exception {
Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
Attr uri = doc.createAttribute("URI");
uri.setNodeValue(url);
ResolverDirectHTTP resolverDirectHTTP = new ResolverDirectHTTP();
resolverDirectHTTP.engineSetProperty("http.proxy.host",proxyHost);
resolverDirectHTTP.engineSetProperty("http.proxy.port", proxyPort);
resolverDirectHTTP.engineSetProperty("http.proxy.username", proxyUsername);
resolverDirectHTTP.engineSetProperty("http.proxy.password", "wrongPassword");
ResourceResolverContext context =
new ResourceResolverContext(uri, url, true);
try {
resolverDirectHTTP.engineResolveURI(context);
Assert.fail("Expected ResourceResolverException");
} catch (ResourceResolverException e) {
Assert.assertEquals("Server returned HTTP response code: 407 for URL: " + url, e.getMessage());
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:22,代码来源:ResolverDirectHTTPTest.java
示例4: testServerAuthWithWrongPassword
import org.apache.xml.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
@Test
@Ignore
public void testServerAuthWithWrongPassword() throws Exception {
Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
Attr uri = doc.createAttribute("URI");
uri.setNodeValue(url);
ResolverDirectHTTP resolverDirectHTTP = new ResolverDirectHTTP();
resolverDirectHTTP.engineSetProperty("http.basic.username", serverUsername);
resolverDirectHTTP.engineSetProperty("http.basic.password", "wrongPassword");
ResourceResolverContext context =
new ResourceResolverContext(uri, url, true);
try {
resolverDirectHTTP.engineResolveURI(context);
Assert.fail("Expected ResourceResolverException");
} catch (ResourceResolverException e) {
Assert.assertEquals("Server returned HTTP response code: 401 for URL: " + url, e.getMessage());
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:20,代码来源:ResolverDirectHTTPTest.java
示例5: engineResolveURI
import org.apache.xml.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
throws ResourceResolverException {
try {
URI uriNew = getNewURI(context.uriToResolve, context.baseUri);
FileInputStream inputStream =
new FileInputStream(dir + "out.xml");
XMLSignatureInput result = new XMLSignatureInput(inputStream);
result.setSourceURI(uriNew.toString());
return result;
} catch (Exception ex) {
throw new ResourceResolverException(
ex, context.uriToResolve, context.baseUri, "generic.EmptyMessage"
);
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:20,代码来源:ProcessingInstructionTest.java
示例6: engineResolveURI
import org.apache.xml.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
/**
* Method engineResolve
*
* @param context
*
* @throws ResourceResolverException
*/
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
throws ResourceResolverException {
try {
String URI = context.uriToResolve;
if (OfflineResolver._uriMap.containsKey(URI)) {
String newURI = OfflineResolver._uriMap.get(URI);
log.debug("Mapped " + URI + " to " + newURI);
InputStream is = new FileInputStream(newURI);
log.debug("Available bytes = " + is.available());
XMLSignatureInput result = new XMLSignatureInput(is);
result.setSourceURI(URI);
result.setMIMEType(OfflineResolver._mimeMap.get(URI));
return result;
} else {
Object exArgs[] = {"The URI " + URI + " is not configured for offline work" };
throw new ResourceResolverException(
"generic.EmptyMessage", exArgs, context.uriToResolve, context.baseUri
);
}
} catch (IOException ex) {
throw new ResourceResolverException(
ex, context.uriToResolve, context.baseUri, "generic.EmptyMessage"
);
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:42,代码来源:OfflineResolver.java
示例7: testBug40783
import org.apache.xml.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
@Test
public void testBug40783() throws Exception {
Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
Attr uri = doc.createAttribute("id");
uri.setNodeValue("urn:ddd:uuu");
doc.createElement("test").setAttributeNode(uri);
try {
ResourceResolver resolver = ResourceResolver.getInstance(uri, null, true);
fail("No exception thrown, but resolver found: " + resolver);
} catch (ResourceResolverException e) {
//
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:14,代码来源:ResolverDirectHTTPTest.java
示例8: engineResolve
import org.apache.xml.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
/**
* Method engineResolve
*
* @param uri
* @param BaseURI
*
* @throws ResourceResolverException
*/
public XMLSignatureInput engineResolve(Attr uri, String BaseURI)
throws ResourceResolverException {
try {
String URI = uri.getNodeValue();
if (OfflineResolver._uriMap.containsKey(URI)) {
String newURI = OfflineResolver._uriMap.get(URI);
log.debug("Mapped " + URI + " to " + newURI);
InputStream is = new FileInputStream(newURI);
log.debug("Available bytes = " + is.available());
XMLSignatureInput result = new XMLSignatureInput(is);
// XMLSignatureInput result = new XMLSignatureInput(inputStream);
result.setSourceURI(URI);
result.setMIMEType((String) OfflineResolver._mimeMap.get(URI));
return result;
} else {
Object exArgs[] = {"The URI " + URI + " is not configured for offline work"};
throw new ResourceResolverException("generic.EmptyMessage", exArgs, uri, BaseURI);
}
} catch (IOException ex) {
throw new ResourceResolverException("generic.EmptyMessage", ex, uri, BaseURI);
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:39,代码来源:OfflineResolver.java
示例9: engineResolve
import org.apache.xml.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
@Override
public XMLSignatureInput engineResolve(Attr uri, String baseURI) throws ResourceResolverException {
LOG.debug("engine resolve: " + uri.getValue());
if (false == this.resources.containsKey(uri.getValue())) {
return null;
}
return new XMLSignatureInput(this.resources.get(uri.getValue()));
}
开发者ID:e-Contract,项目名称:eid-applet,代码行数:9,代码来源:XmlSignatureServiceBeanTest.java
示例10: getReferencedElement
import org.apache.xml.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
private <TObj> TObj getReferencedElement(
String objReference,
Map<Element, TObj> mapper)
{
if (!objReference.startsWith("#"))
throw new IllegalArgumentException();
if (mapper.isEmpty())
return null;
// A little workaround to be able to use the ResourceResolver.
Attr refAttr = this.signatureDoc.createAttributeNS(null, "ref");
refAttr.setNodeValue(objReference);
this.signatureDoc.createElementNS(null, "dummy").setAttributeNodeNS(refAttr);
try
{
XMLSignatureInput refData = ResourceResolver.getInstance(refAttr, "", true).resolve(refAttr, "", true);
// This has to be a NodeSet data because it is a same-document reference.
Node refNode = refData.getSubNode();
if (refNode.getNodeType() != Node.ELEMENT_NODE)
return null;
// May return null.
return mapper.get((Element)refNode);
} catch (ResourceResolverException ex)
{
// Maybe an exception should be thrown...
return null;
}
}
开发者ID:luisgoncalves,项目名称:xades4j,代码行数:31,代码来源:QualifyingPropertyVerificationContext.java
示例11: engineResolveURI
import org.apache.xml.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context) throws ResourceResolverException
{
XMLSignatureInput input = new XMLSignatureInput(context.attr.getValue().getBytes());
resolveCount++;
return input;
}
开发者ID:luisgoncalves,项目名称:xades4j,代码行数:8,代码来源:OtherSignerTests.java
注:本文中的org.apache.xml.security.utils.resolver.ResourceResolverException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论