org.apache.xml.security.Init.isInitialized()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(184)

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

Init.isInitialized介绍

[英]Method isInitialized
[中]方法初始化

代码示例

代码示例来源:origin: cloudfoundry/uaa

@BeforeAll
public static void initializeOpenSAML() throws Exception {
  if (!org.apache.xml.security.Init.isInitialized()) {
    DefaultBootstrap.bootstrap();
  }
}

代码示例来源:origin: org.apache.santuario/xmlsec

/**
 * Method getExceptionMessage
 *
 * @param msgID
 * @return message translated
 *
 */
public static String getExceptionMessage(String msgID) {
  try {
    return resourceBundle.getString(msgID);
  } catch (Throwable t) {
    if (org.apache.xml.security.Init.isInitialized()) {
      return "No message with ID \"" + msgID
      + "\" found in resource bundle \""
      + Constants.exceptionMessagesResourceBundleBase + "\"";
    }
    return I18n.NOT_INITIALIZED_MSG;
  }
}

代码示例来源:origin: org.apache.santuario/xmlsec

/**
 * Method getExceptionMessage
 *
 * @param msgID
 * @param exArgs
 * @return message translated
 */
public static String getExceptionMessage(String msgID, Object exArgs[]) {
  try {
    return MessageFormat.format(resourceBundle.getString(msgID), exArgs);
  } catch (Throwable t) {
    if (org.apache.xml.security.Init.isInitialized()) {
      return "No message with ID \"" + msgID
      + "\" found in resource bundle \""
      + Constants.exceptionMessagesResourceBundleBase + "\"";
    }
    return I18n.NOT_INITIALIZED_MSG;
  }
}

代码示例来源:origin: io.apigee.opensaml/xmltooling

/** Constructor. */
public SignatureUnmarshaller() {
  if (!Init.isInitialized()) {
    log.debug("Initializing XML security library");
    Init.init();
  }
}

代码示例来源:origin: org.opensaml/xmltooling

/** Constructor. */
public SignatureUnmarshaller() {
  if (!Init.isInitialized()) {
    log.debug("Initializing XML security library");
    Init.init();
  }
}

代码示例来源:origin: io.apigee.opensaml/xmltooling

/** Constructor. */
public SignatureMarshaller() {
  if (!Init.isInitialized()) {
    log.debug("Initializing XML security library");
    Init.init();
  }
}

代码示例来源:origin: org.opensaml/xmltooling

/** Constructor. */
public SignatureMarshaller() {
  if (!Init.isInitialized()) {
    log.debug("Initializing XML security library");
    Init.init();
  }
}

代码示例来源:origin: org.apache.santuario/xmlsec

/**
 * Method getExceptionMessage
 *
 * @param msgID
 * @param originalException
 * @return message translated
 */
public static String getExceptionMessage(String msgID, Exception originalException) {
  try {
    Object exArgs[] = { originalException.getMessage() };
    return MessageFormat.format(resourceBundle.getString(msgID), exArgs);
  } catch (Throwable t) {
    if (org.apache.xml.security.Init.isInitialized()) {
      return "No message with ID \"" + msgID
      + "\" found in resource bundle \""
      + Constants.exceptionMessagesResourceBundleBase
      + "\". Original Exception was a "
      + originalException.getClass().getName() + " and message "
      + originalException.getMessage();
    }
    return I18n.NOT_INITIALIZED_MSG;
  }
}

代码示例来源:origin: org.opensaml/opensaml

/**
 * Initializes the Apache XMLSecurity libary.
 * 
 * @throws ConfigurationException thrown is there is a problem initializing the library
 */
protected static void initializeXMLSecurity() throws ConfigurationException {
  Logger log = getLogger();
  String lineBreakPropName = "org.apache.xml.security.ignoreLineBreaks";
  // Don't override if it was set explicitly
  if (System.getProperty(lineBreakPropName) == null) {
    System.setProperty(lineBreakPropName, "true");
  }
  if (!Init.isInitialized()) {
    log.debug("Initializing Apache XMLSecurity library");
    Init.init();
  }
}

代码示例来源:origin: net.shibboleth.metadata/aggregator-pipeline

super.doInitialize();
if (!Init.isInitialized()) {
  Init.isInitialized();

代码示例来源:origin: holodeck-b2b/Holodeck-B2B

/**
 * Converts a {@link Document} representation of the SOAP Envelope into a Axiom representation.
 *
 * @param document The standard DOM representation of the SOAP Envelope
 * @return An {@link SOAPEnvelope} object containing the Axiom representation of the SOAP envelope, or <br>
 * <code>null</code> if the conversion fails
 */
public static SOAPEnvelope convertDOMSOAPEnvToAxiom(final Document document) {
  try {
    // If no security action is performed the Santuario may not have been initialized which causes the
    // XMLUtils.outputDOM to fail
    if (!org.apache.xml.security.Init.isInitialized())
      org.apache.xml.security.Init.init();
    // The call of the Document.normalizeDocument() method is to fix the exception described here:
    // http://apache-xml-project.6118.n7.nabble.com/Undeclared-namespace-prefix-quot-ds-quot-error-td36346.html
    document.normalizeDocument();
    final ByteArrayOutputStream os = new ByteArrayOutputStream();
    XMLUtils.outputDOM(document.getDocumentElement(), os, true);
    final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray());
    final SOAPModelBuilder stAXSOAPModelBuilder = OMXMLBuilderFactory.createSOAPModelBuilder(bais, null);
    final SOAPEnvelope env = stAXSOAPModelBuilder.getSOAPEnvelope();
    env.build();
    return env;
  } catch (final Exception e) {
    // If anything goes wrong converting the document, just return null
    return null;
  }
}

代码示例来源:origin: net.shibboleth.metadata/aggregator-pipeline

/** {@inheritDoc} */
  @Override protected void doInitialize() throws ComponentInitializationException {
    super.doInitialize();

    if (verificationKey == null) {
      throw new ComponentInitializationException("Unable to initialize " + getId()
          + ", no verification key was specified");
    }

    validator = new XMLSignatureValidator(verificationKey,
        blacklistedDigests, blacklistedSignatureMethods, permittingEmptyReferences);

    if (!Init.isInitialized()) {
      Init.init();
    }
  }
}

相关文章