当前位置: 首页>>代码示例>>Java>>正文


Java ResourceResolverException类代码示例

本文整理汇总了Java中com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverException的典型用法代码示例。如果您正苦于以下问题:Java ResourceResolverException类的具体用法?Java ResourceResolverException怎么用?Java ResourceResolverException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResourceResolverException类属于com.sun.org.apache.xml.internal.security.utils.resolver包,在下文中一共展示了ResourceResolverException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: engineResolveURI

import com.sun.org.apache.xml.internal.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.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:ResolverLocalFilesystem.java

示例2: getContentsBeforeTransformation

import com.sun.org.apache.xml.internal.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 =
            this.constructionElement.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("empty", ex);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:Reference.java

示例3: engineResolve

import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
/**
 * @inheritDoc
 */
public XMLSignatureInput engineResolve(Attr uri, String BaseURI)
        throws ResourceResolverException {

  try {
     URI uriNew = getNewURI(uri.getNodeValue(), BaseURI);

     // if the URI contains a fragment, ignore it
     URI uriNewNoFrag = new URI(uriNew);

     uriNewNoFrag.setFragment(null);

     String fileName =
        ResolverLocalFilesystem
           .translateUriToFilename(uriNewNoFrag.toString());
     FileInputStream inputStream = new FileInputStream(fileName);
     XMLSignatureInput result = new XMLSignatureInput(inputStream);

     result.setSourceURI(uriNew.toString());

     return result;
  } catch (Exception e) {
     throw new ResourceResolverException("generic.EmptyMessage", e, uri,
                                         BaseURI);
   }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:29,代码来源:ResolverLocalFilesystem.java

示例4: engineResolve

import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
/**
 * Method engineResolve
 *
 * Wird das gleiche Dokument referenziert?
 * Wird ein anderes Dokument referenziert?
 * @inheritDoc
 * @param uri
 * @param BaseURI
 *
 */
public XMLSignatureInput engineResolve(Attr uri, String BaseURI)
    throws ResourceResolverException
{

   String uriNodeValue = uri.getNodeValue();
   Document doc = uri.getOwnerElement().getOwnerDocument();


   Node selectedElem = null;
   if (uriNodeValue.equals("")) {

      /*
       * Identifies the node-set (minus any comment nodes) of the XML
       * resource containing the signature
       */

      log.log(java.util.logging.Level.FINE, "ResolverFragment with empty URI (means complete document)");
      selectedElem = doc;
   } else {

      /*
       * URI="#chapter1"
       * Identifies a node-set containing the element with ID attribute
       * value 'chapter1' of the XML resource containing the signature.
       * XML Signature (and its applications) modify this node-set to
       * include the element plus all descendents including namespaces and
       * attributes -- but not comments.
       */
      String id = uriNodeValue.substring(1);

      // Element selectedElem = doc.getElementById(id);
      selectedElem = IdResolver.getElementById(doc, id);
      if (selectedElem==null) {
             Object exArgs[] = { id };
         throw new ResourceResolverException(
            "signature.Verification.MissingID", exArgs, uri, BaseURI);
      }
      if (log.isLoggable(java.util.logging.Level.FINE))
             log.log(java.util.logging.Level.FINE, "Try to catch an Element with ID " + id + " and Element was " + selectedElem);
   }

   XMLSignatureInput result = new XMLSignatureInput(selectedElem);
   result.setExcludeComments(true);

   //log.log(java.util.logging.Level.FINE, "We return a nodeset with " + resultSet.size() + " nodes");
   result.setMIMEType("text/xml");
       result.setSourceURI((BaseURI != null) ? BaseURI.concat(uri.getNodeValue()) :
               uri.getNodeValue());
   return result;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:61,代码来源:ResolverFragment.java

示例5: engineResolve

import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverException; //导入依赖的package包/类
/**
 * @inheritDoc
 */
public XMLSignatureInput engineResolve(Attr uri, String BaseURI)
        throws ResourceResolverException {

   Node resultNode = null;
   Document doc = uri.getOwnerElement().getOwnerDocument();

     String uriStr=uri.getNodeValue();
      if (isXPointerSlash(uriStr)) {
         resultNode = doc;

      } else if (isXPointerId(uriStr)) {
         String id = getXPointerId(uriStr);
         resultNode =IdResolver.getElementById(doc, id);

         // log.log(java.util.logging.Level.FINE, "Use #xpointer(id('" + id + "')) on element " + selectedElem);

         if (resultNode == null) {
            Object exArgs[] = { id };

            throw new ResourceResolverException(
               "signature.Verification.MissingID", exArgs, uri, BaseURI);
         }
         /*
         resultNodes =
            cXPathAPI
               .selectNodeList(selectedElem, Canonicalizer
                  .XPATH_C14N_WITH_COMMENTS_SINGLE_NODE);*/
      }


   XMLSignatureInput result = new XMLSignatureInput(resultNode);

   result.setMIMEType("text/xml");
   if (BaseURI != null && BaseURI.length() > 0) {
       result.setSourceURI(BaseURI.concat(uri.getNodeValue()));
   } else {
       result.setSourceURI(uri.getNodeValue());
   }

   return result;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:45,代码来源:ResolverXPointer.java


注:本文中的com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。