Java 类org.apache.catalina.webresources.TomcatURLStreamHandlerFactory 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:AbstractEmbeddedServletContainerFactoryTests.java   
@BeforeClass
@AfterClass
public static void uninstallUrlStreamHandlerFactory() {
    ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance",
            null);
    ReflectionTestUtils.setField(URL.class, "factory", null);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:TomcatEmbeddedServletContainerFactory.java   
/**
 * Configure Tomcat's {@link AbstractHttp11JsseProtocol} for SSL.
 * @param protocol the protocol
 * @param ssl the ssl details
 */
protected void configureSsl(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
    protocol.setSSLEnabled(true);
    protocol.setSslProtocol(ssl.getProtocol());
    configureSslClientAuth(protocol, ssl);
    protocol.setKeystorePass(ssl.getKeyStorePassword());
    protocol.setKeyPass(ssl.getKeyPassword());
    protocol.setKeyAlias(ssl.getKeyAlias());
    String ciphers = StringUtils.arrayToCommaDelimitedString(ssl.getCiphers());
    protocol.setCiphers(StringUtils.hasText(ciphers) ? ciphers : null);
    if (ssl.getEnabledProtocols() != null) {
        try {
            for (SSLHostConfig sslHostConfig : protocol.findSslHostConfigs()) {
                sslHostConfig.setProtocols(StringUtils
                        .arrayToCommaDelimitedString(ssl.getEnabledProtocols()));
            }
        }
        catch (NoSuchMethodError ex) {
            // Tomcat 8.0.x or earlier
            Assert.isTrue(
                    protocol.setProperty("sslEnabledProtocols",
                            StringUtils.arrayToCommaDelimitedString(
                                    ssl.getEnabledProtocols())),
                    "Failed to set sslEnabledProtocols");
        }
    }
    if (getSslStoreProvider() != null) {
        TomcatURLStreamHandlerFactory instance = TomcatURLStreamHandlerFactory
                .getInstance();
        instance.addUserFactory(
                new SslStoreProviderUrlStreamHandlerFactory(getSslStoreProvider()));
        protocol.setKeystoreFile(
                SslStoreProviderUrlStreamHandlerFactory.KEY_STORE_URL);
        protocol.setTruststoreFile(
                SslStoreProviderUrlStreamHandlerFactory.TRUST_STORE_URL);
    }
    else {
        configureSslKeyStore(protocol, ssl);
        configureSslTrustStore(protocol, ssl);
    }
}
项目:RAFTools    文件:NIOResourceRoot.java   
@Override
protected void initInternal() throws LifecycleException {
    TomcatURLStreamHandlerFactory.register();
}
项目:WebAPI    文件:WebApi.java   
public static void main(final String[] args) throws Exception 
{
    TomcatURLStreamHandlerFactory.disable();
    new SpringApplicationBuilder(WebApi.class).run(args);
}