本文整理汇总了Java中org.apache.coyote.http11.AbstractHttp11JsseProtocol类的典型用法代码示例。如果您正苦于以下问题:Java AbstractHttp11JsseProtocol类的具体用法?Java AbstractHttp11JsseProtocol怎么用?Java AbstractHttp11JsseProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractHttp11JsseProtocol类属于org.apache.coyote.http11包,在下文中一共展示了AbstractHttp11JsseProtocol类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: configureSslTrustStore
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
private void configureSslTrustStore(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
if (ssl.getTrustStore() != null) {
try {
protocol.setTruststoreFile(
ResourceUtils.getURL(ssl.getTrustStore()).toString());
}
catch (FileNotFoundException ex) {
throw new EmbeddedServletContainerException(
"Could not load trust store: " + ex.getMessage(), ex);
}
}
protocol.setTruststorePass(ssl.getTrustStorePassword());
if (ssl.getTrustStoreType() != null) {
protocol.setTruststoreType(ssl.getTrustStoreType());
}
if (ssl.getTrustStoreProvider() != null) {
protocol.setTruststoreProvider(ssl.getTrustStoreProvider());
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:21,代码来源:TomcatEmbeddedServletContainerFactory.java
示例2: configureSsl
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
/**
* 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());
protocol.setCiphers(StringUtils.arrayToCommaDelimitedString(ssl.getCiphers()));
if (ssl.getEnabledProtocols() != null) {
protocol.setProperty("sslEnabledProtocols",
StringUtils.arrayToCommaDelimitedString(ssl.getEnabledProtocols()));
}
if (getSslStoreProvider() != null) {
configureSslStoreProvider(protocol, getSslStoreProvider());
}
else {
configureSslKeyStore(protocol, ssl);
configureSslTrustStore(protocol, ssl);
}
}
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:26,代码来源:TomcatEmbeddedServletContainerFactory.java
示例3: sslCiphersConfiguration
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
@Test
public void sslCiphersConfiguration() throws Exception {
Ssl ssl = new Ssl();
ssl.setKeyStore("test.jks");
ssl.setKeyStorePassword("secret");
ssl.setCiphers(new String[] { "ALPHA", "BRAVO", "CHARLIE" });
TomcatEmbeddedServletContainerFactory factory = getFactory();
factory.setSsl(ssl);
Tomcat tomcat = getTomcat(factory);
Connector connector = tomcat.getConnector();
AbstractHttp11JsseProtocol<?> jsseProtocol = (AbstractHttp11JsseProtocol<?>) connector
.getProtocolHandler();
assertThat(jsseProtocol.getCiphers()).isEqualTo("ALPHA,BRAVO,CHARLIE");
}
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:18,代码来源:TomcatEmbeddedServletContainerFactoryTests.java
示例4: sslEnabledMultipleProtocolsConfiguration
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
@Test
public void sslEnabledMultipleProtocolsConfiguration() throws Exception {
Ssl ssl = new Ssl();
ssl.setKeyStore("test.jks");
ssl.setKeyStorePassword("secret");
ssl.setEnabledProtocols(new String[] { "TLSv1.1", "TLSv1.2" });
ssl.setCiphers(new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", "BRAVO" });
TomcatEmbeddedServletContainerFactory factory = getFactory();
factory.setSsl(ssl);
this.container = factory
.getEmbeddedServletContainer(sessionServletRegistration());
Tomcat tomcat = ((TomcatEmbeddedServletContainer) this.container).getTomcat();
Connector connector = tomcat.getConnector();
AbstractHttp11JsseProtocol<?> jsseProtocol = (AbstractHttp11JsseProtocol<?>) connector
.getProtocolHandler();
assertThat(jsseProtocol.getSslProtocol()).isEqualTo("TLS");
assertThat(jsseProtocol.getProperty("sslEnabledProtocols"))
.isEqualTo("TLSv1.1,TLSv1.2");
}
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:23,代码来源:TomcatEmbeddedServletContainerFactoryTests.java
示例5: sslEnabledProtocolsConfiguration
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
@Test
public void sslEnabledProtocolsConfiguration() throws Exception {
Ssl ssl = new Ssl();
ssl.setKeyStore("test.jks");
ssl.setKeyStorePassword("secret");
ssl.setEnabledProtocols(new String[] { "TLSv1.2" });
ssl.setCiphers(new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", "BRAVO" });
TomcatEmbeddedServletContainerFactory factory = getFactory();
factory.setSsl(ssl);
this.container = factory
.getEmbeddedServletContainer(sessionServletRegistration());
Tomcat tomcat = ((TomcatEmbeddedServletContainer) this.container).getTomcat();
Connector connector = tomcat.getConnector();
AbstractHttp11JsseProtocol<?> jsseProtocol = (AbstractHttp11JsseProtocol<?>) connector
.getProtocolHandler();
assertThat(jsseProtocol.getSslProtocol()).isEqualTo("TLS");
assertThat(jsseProtocol.getProperty("sslEnabledProtocols")).isEqualTo("TLSv1.2");
}
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:22,代码来源:TomcatEmbeddedServletContainerFactoryTests.java
示例6: configureSslTrustStore
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
private void configureSslTrustStore(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
if (ssl.getTrustStore() != null) {
try {
protocol.setTruststoreFile(
ResourceUtils.getURL(ssl.getTrustStore()).toString());
}
catch (FileNotFoundException ex) {
throw new EmbeddedServletContainerException(
"Could not load trust store: " + ex.getMessage(), ex);
}
}
protocol.setTruststorePass(ssl.getTrustStorePassword());
if (ssl.getTrustStoreType() != null) {
protocol.setTruststoreType(ssl.getTrustStoreType());
}
if (ssl.getTrustStoreProvider() != null) {
protocol.setTruststoreProvider(ssl.getTrustStoreProvider());
}
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:20,代码来源:TomcatEmbeddedServletContainerFactory.java
示例7: sslCiphersConfiguration
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
@Test
public void sslCiphersConfiguration() throws Exception {
Ssl ssl = new Ssl();
ssl.setKeyStore("test.jks");
ssl.setKeyStorePassword("secret");
ssl.setCiphers(new String[] { "ALPHA", "BRAVO", "CHARLIE" });
TomcatEmbeddedServletContainerFactory factory = getFactory();
factory.setSsl(ssl);
Tomcat tomcat = getTomcat(factory);
Connector connector = tomcat.getConnector();
AbstractHttp11JsseProtocol<?> jsseProtocol = (AbstractHttp11JsseProtocol<?>) connector
.getProtocolHandler();
assertThat(jsseProtocol.getCiphers(), equalTo("ALPHA,BRAVO,CHARLIE"));
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:18,代码来源:TomcatEmbeddedServletContainerFactoryTests.java
示例8: build
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
public void build(AbstractHttp11JsseProtocol<?> protocol,SSLProperties sslProperties) {
protocol.setKeystoreFile(sslProperties.getKeyStoreFile()); // contains server keypair
protocol.setKeyPass(sslProperties.getKeyStorePass());
sslProperties.getKeyStoreType().ifPresent(type->protocol.setKeystoreType(type));
sslProperties.getKeyStoreProvider().ifPresent(provider->protocol.setKeystoreProvider(provider));
sslProperties.getTrustStoreFile().ifPresent(file->protocol.setTruststoreFile(file)); // contains client certificate
sslProperties.getTrustStorePass().ifPresent(pass->protocol.setTruststorePass(pass));
sslProperties.getTrustStoreType().ifPresent(type->protocol.setTruststoreType(type));
sslProperties.getTrustStoreProvider().ifPresent(provider->protocol.setTruststoreProvider(provider));
sslProperties.getClientAuth().ifPresent(auth->protocol.setClientAuth(auth));
protocol.setSSLEnabled(true);
sslProperties.getCiphers().ifPresent(ciphers->protocol.setCiphers(ciphers));
sslProperties.getProtocol().ifPresent(pr->protocol.setSslProtocol(pr));
}
开发者ID:aol,项目名称:micro-server,代码行数:20,代码来源:SSLConfigurationBuilder.java
示例9: getConnectorInfos
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
/**
* Gets the connector infos.
*
* @param connectors the connectors
* @return the connector infos
* @throws IllegalAccessException the illegal access exception
* @throws InvocationTargetException the invocation target exception
*/
private List<ConnectorInfo> getConnectorInfos(List<Connector> connectors)
throws IllegalAccessException, InvocationTargetException {
List<ConnectorInfo> infos = new ArrayList<>();
for (Connector connector : connectors) {
if (!connector.getSecure()) {
continue;
}
ProtocolHandler protocolHandler = connector.getProtocolHandler();
if (protocolHandler instanceof AbstractHttp11JsseProtocol) {
AbstractHttp11JsseProtocol<?> protocol = (AbstractHttp11JsseProtocol<?>) protocolHandler;
if (!protocol.getSecure()) {
continue;
}
infos.add(toConnectorInfo(protocol));
}
}
return infos;
}
开发者ID:psi-probe,项目名称:psi-probe,代码行数:29,代码来源:ListCertificatesController.java
示例10: customizeSsl
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
private void customizeSsl(Connector connector) {
ProtocolHandler handler = connector.getProtocolHandler();
Assert.state(handler instanceof AbstractHttp11JsseProtocol,
"To use SSL, the connector's protocol handler must be an "
+ "AbstractHttp11JsseProtocol subclass");
configureSsl((AbstractHttp11JsseProtocol<?>) handler, getSsl());
connector.setScheme("https");
connector.setSecure(true);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:TomcatEmbeddedServletContainerFactory.java
示例11: configureSslClientAuth
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
private void configureSslClientAuth(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
if (ssl.getClientAuth() == ClientAuth.NEED) {
protocol.setClientAuth(Boolean.TRUE.toString());
}
else if (ssl.getClientAuth() == ClientAuth.WANT) {
protocol.setClientAuth("want");
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:TomcatEmbeddedServletContainerFactory.java
示例12: configureSslKeyStore
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
private void configureSslKeyStore(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
try {
protocol.setKeystoreFile(ResourceUtils.getURL(ssl.getKeyStore()).toString());
}
catch (FileNotFoundException ex) {
throw new EmbeddedServletContainerException(
"Could not load key store: " + ex.getMessage(), ex);
}
if (ssl.getKeyStoreType() != null) {
protocol.setKeystoreType(ssl.getKeyStoreType());
}
if (ssl.getKeyStoreProvider() != null) {
protocol.setKeystoreProvider(ssl.getKeyStoreProvider());
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:TomcatEmbeddedServletContainerFactory.java
示例13: configureSslStoreProvider
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
protected void configureSslStoreProvider(AbstractHttp11JsseProtocol<?> protocol,
SslStoreProvider sslStoreProvider) {
Assert.isInstanceOf(Http11NioProtocol.class, protocol,
"SslStoreProvider can only be used with Http11NioProtocol");
((Http11NioProtocol) protocol).getEndpoint().setAttribute("sslStoreProvider",
sslStoreProvider);
protocol.setSslImplementationName(
TomcatEmbeddedJSSEImplementation.class.getName());
}
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:10,代码来源:TomcatEmbeddedServletContainerFactory.java
示例14: configureSsl
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
/**
* 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());
configureSslKeyStore(protocol, ssl);
String ciphers = StringUtils.arrayToCommaDelimitedString(ssl.getCiphers());
protocol.setCiphers(ciphers);
configureSslTrustStore(protocol, ssl);
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:18,代码来源:TomcatEmbeddedServletContainerFactory.java
示例15: addSSL
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
private void addSSL(Connector connector) {
SSLProperties sslProperties = serverData.getRootContext().getBean(SSLProperties.class);
ProtocolHandler handler = connector.getProtocolHandler();
if(sslProperties!= null && handler instanceof AbstractHttp11JsseProtocol){
new SSLConfigurationBuilder().build((AbstractHttp11JsseProtocol)handler,sslProperties);
connector.setScheme("https");
connector.setSecure(true);
}
}
开发者ID:aol,项目名称:micro-server,代码行数:10,代码来源:TomcatApplication.java
示例16: SslHostConfigHelper
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
/**
* Instantiates a new SSL host config helper.
*
* @param protocol the protocol
* @param info the info
* @throws IllegalAccessException the illegal access exception
* @throws InvocationTargetException the invocation target exception
*/
public SslHostConfigHelper(AbstractHttp11JsseProtocol<?> protocol, ConnectorInfo info)
throws IllegalAccessException, InvocationTargetException {
SSLHostConfig[] sslHostConfigs = protocol.findSslHostConfigs();
List<SslHostConfigInfo> sslHostConfigInfos = new ArrayList<>(sslHostConfigs.length);
info.setSslHostConfigInfos(sslHostConfigInfos);
for (SSLHostConfig sslHostConfig : sslHostConfigs) {
sslHostConfigInfos.add(toSslHostConfigInfo(sslHostConfig));
}
}
开发者ID:psi-probe,项目名称:psi-probe,代码行数:19,代码来源:SslHostConfigHelper.java
示例17: toConnectorInfo
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
/**
* To connector info.
*
* @param protocol the protocol
* @return the connector info
* @throws IllegalAccessException the illegal access exception
* @throws InvocationTargetException the invocation target exception
*/
private ConnectorInfo toConnectorInfo(AbstractHttp11JsseProtocol<?> protocol)
throws IllegalAccessException, InvocationTargetException {
ConnectorInfo info = new ConnectorInfo();
info.setName(ObjectName.unquote(protocol.getName()));
try {
// Introduced in Tomcat 8.5.x+
Object defaultSslHostConfigName =
MethodUtils.invokeMethod(protocol, "getDefaultSSLHostConfigName");
if (defaultSslHostConfigName == null) {
logger.error("Cannot determine defaultSslHostConfigName");
return info;
}
info.setDefaultSslHostConfigName(String.valueOf(defaultSslHostConfigName));
new SslHostConfigHelper(protocol, info);
} catch (NoSuchMethodException e) {
logger.trace("", e);
// We are using Tomcat 7 or 8, fill in the old way
OldConnectorInfo oldConnectorInfo = new OldConnectorInfo();
BeanUtils.copyProperties(oldConnectorInfo, protocol);
info.setDefaultSslHostConfigName("_default_");
info.setSslHostConfigInfos(oldConnectorInfo.getSslHostConfigInfos());
}
return info;
}
开发者ID:psi-probe,项目名称:psi-probe,代码行数:36,代码来源:ListCertificatesController.java
示例18: doTestCustomTrustManager
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
private void doTestCustomTrustManager(boolean serverTrustAll)
throws Exception {
if (!TesterSupport.RFC_5746_SUPPORTED) {
// Make sure SSL renegotiation is not disabled in the JVM
System.setProperty("sun.security.ssl.allowUnsafeRenegotiation",
"true");
}
Tomcat tomcat = getTomcatInstance();
Assume.assumeTrue("SSL renegotiation has to be supported for this test",
TesterSupport.isRenegotiationSupported(getTomcatInstance()));
TesterSupport.configureClientCertContext(tomcat);
// Override the defaults
ProtocolHandler handler = tomcat.getConnector().getProtocolHandler();
if (handler instanceof AbstractHttp11JsseProtocol) {
((AbstractHttp11JsseProtocol<?>) handler).setTruststoreFile(null);
} else {
// Unexpected
fail("Unexpected handler type");
}
if (serverTrustAll) {
tomcat.getConnector().setAttribute("trustManagerClassName",
"org.apache.tomcat.util.net.TesterSupport$TrustAllCerts");
}
// Start Tomcat
tomcat.start();
TesterSupport.configureClientSsl();
// Unprotected resource
ByteChunk res =
getUrl("https://localhost:" + getPort() + "/unprotected");
assertEquals("OK", res.toString());
// Protected resource
res.recycle();
int rc = -1;
try {
rc = getUrl("https://localhost:" + getPort() + "/protected", res,
null, null);
} catch (SocketException se) {
if (serverTrustAll) {
fail(se.getMessage());
se.printStackTrace();
}
} catch (SSLException he) {
if (serverTrustAll) {
fail(he.getMessage());
he.printStackTrace();
}
}
if (serverTrustAll) {
assertEquals(200, rc);
assertEquals("OK-" + TesterSupport.ROLE, res.toString());
} else {
assertTrue(rc != 200);
assertEquals("", res.toString());
}
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:65,代码来源:TestCustomSsl.java
示例19: configureSsl
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
/**
* 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);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:46,代码来源:TomcatEmbeddedServletContainerFactory.java
示例20: configureSslStoreProvider
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入依赖的package包/类
protected void configureSslStoreProvider(AbstractHttp11JsseProtocol<?> protocol,
SslStoreProvider sslStoreProvider) {
Assert.isInstanceOf(Http11NioProtocol.class, protocol,
"SslStoreProvider can only be used with Http11NioProtocol");
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:6,代码来源:TomcatEmbeddedServletContainerFactory.java
注:本文中的org.apache.coyote.http11.AbstractHttp11JsseProtocol类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论