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


Java Http11NioProtocol类代码示例

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


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

示例1: servletContainer

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
    TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();

    tomcat.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
        connector.setScheme("https");
        connector.setPort(cfg.getPort());
        Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
        protocol.setSSLEnabled(true);
        protocol.setSSLCertificateKeyFile(cfg.getKey());
        protocol.setSSLCertificateFile(cfg.getCert());
        cfg.getChain().ifPresent(protocol::setSSLCertificateChainFile);
    });

    return tomcat;
}
 
开发者ID:kamax-io,项目名称:mxhsd,代码行数:17,代码来源:MxhsdFederationApp.java

示例2: customize

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
  if (!(container instanceof TomcatEmbeddedServletContainerFactory)) {
    return;
  }
  if (!environment.containsProperty(TOMCAT_ACCEPTOR_COUNT)) {
    return;
  }
  TomcatEmbeddedServletContainerFactory tomcat =
      (TomcatEmbeddedServletContainerFactory) container;
  tomcat.addConnectorCustomizers(new TomcatConnectorCustomizer() {
    @Override
    public void customize(Connector connector) {
      ProtocolHandler handler = connector.getProtocolHandler();
      if (handler instanceof Http11NioProtocol) {
        Http11NioProtocol http = (Http11NioProtocol) handler;
        int acceptCount = Integer.parseInt(environment.getProperty(TOMCAT_ACCEPTOR_COUNT));
        http.setBacklog(acceptCount);
        logger.info("Setting tomcat accept count to {}", acceptCount);
      }

    }
  });
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:25,代码来源:TomcatContainerCustomizer.java

示例3: createSSLConnector

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
private Connector createSSLConnector(String absoluteKeyStore, String keystorePass) {
	Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
	Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
	try {
		connector.setPort(8443);
		connector.setSecure(true);
		connector.setScheme("https");
		
		protocol.setSSLEnabled(true);
		protocol.setKeystoreFile(absoluteKeyStore);
		protocol.setKeystorePass(keystorePass);
		protocol.setKeystoreType("JKS");
		protocol.setKeyAlias("tomcat");
		return connector;
	} catch(Exception ex) {
		throw new IllegalStateException("Can't access to keystore: [" + absoluteKeyStore + "]", ex);
	}
}
 
开发者ID:kflauri2312lffds,项目名称:Android_watch_magpie,代码行数:19,代码来源:OAuth2SecurityConfiguration.java

示例4: setup

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
@Override
public void setup() {
	this.port = SocketUtils.findAvailableTcpPort();

	Connector connector = new Connector(Http11NioProtocol.class.getName());
	connector.setPort(this.port);

	File baseDir = createTempDir("tomcat");
	String baseDirPath = baseDir.getAbsolutePath();

	this.tomcatServer = new Tomcat();
	this.tomcatServer.setBaseDir(baseDirPath);
	this.tomcatServer.setPort(this.port);
	this.tomcatServer.getService().addConnector(connector);
	this.tomcatServer.setConnector(connector);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:17,代码来源:TomcatWebSocketTestServer.java

示例5: createSslConnector

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
/**
 * Configures ssl connector
 *
 * @return
 */
Connector createSslConnector() {
    log.info("About to start ssl connector at port {} with {} keystoreFile", tlsPort, keystoreFile);
    final String absoluteKeystoreFile = new File(keystoreFile).getAbsolutePath();

    Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
    connector.setPort(tlsPort);
    connector.setSecure(true);
    connector.setScheme("https");

    Http11NioProtocol proto = (Http11NioProtocol) connector.getProtocolHandler();
    proto.setSSLEnabled(true);
    proto.setKeystoreFile(absoluteKeystoreFile);
    proto.setKeystorePass(keystorePass);
    proto.setKeystoreType("PKCS12");
    proto.setSslProtocol("TLSv1.2");
    proto.setKeyAlias("tomcat");
    return connector;
}
 
开发者ID:codeabovelab,项目名称:haven-platform,代码行数:24,代码来源:ServletContainerConfiguration.java

示例6: createSslConnector

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
private Connector createSslConnector() {
    Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
    Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
    try {
        File keystore = new ClassPathResource(keystorePath).getFile();
        connector.setScheme(HTTPS_SCHEME);
        connector.setSecure(true);
        connector.setPort(Integer.parseInt(httpsPort));
        protocol.setSSLEnabled(true);
        protocol.setKeystoreFile(keystore.getAbsolutePath());
        protocol.setKeystorePass(keystorePasswd);
        protocol.setTruststoreFile(keystore.getAbsolutePath());
        protocol.setTruststorePass(truststorePasswd);
        protocol.setKeyAlias(keyAlias);
        return connector;
    } catch (IOException ex) {
        throw new IllegalStateException("cant access keystore: [" + "keystore"
                + "] or truststore: [" + "keystore" + "]", ex);
    }
}
 
开发者ID:sdl,项目名称:odata,代码行数:21,代码来源:TomcatConfiguration.java

示例7: createSslConnector

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
private Connector createSslConnector() {
	Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
	Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
	try {
		File keystore = getKeyStoreFile();
		File truststore = keystore;
		connector.setScheme("https");
		connector.setSecure(true);
		connector.setPort(port());
		protocol.setSSLEnabled(true);
		protocol.setKeystoreFile(keystore.getAbsolutePath());
		protocol.setKeystorePass("changeit");
		protocol.setTruststoreFile(truststore.getAbsolutePath());
		protocol.setTruststorePass("changeit");
		protocol.setKeyAlias("apitester");
		return connector;
	}
	catch (IOException ex) {
		throw new IllegalStateException("cant access keystore: [" + "keystore"
				+ "] or truststore: [" + "keystore" + "]", ex);
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:23,代码来源:SampleTomcatTwoConnectorsApplication.java

示例8: createSslConnector

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
private Connector createSslConnector() throws FileNotFoundException {
	Connector connector = new Connector(Http11NioProtocol.class.getName());
	Http11NioProtocol protocol =
			(Http11NioProtocol)connector.getProtocolHandler();
	connector.setPort(8443);
	connector.setSecure(true);
	connector.setScheme("https");
	protocol.setSSLEnabled(true);
	protocol.setKeyAlias("learningspringboot");
	protocol.setKeystorePass("password");
	protocol.setKeystoreFile(ResourceUtils
		.getFile("src/main/resources/tomcat.keystore")
		.getAbsolutePath());
	protocol.setSslProtocol("TLS");
	return connector;
}
 
开发者ID:learning-spring-boot,项目名称:learning-spring-boot-code-1.2,代码行数:17,代码来源:SecureTomcatConfiguration.java

示例9: TomcatWebSocketTestServer

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
public TomcatWebSocketTestServer(int port) {

  this.port = port;

  Connector connector = new Connector(Http11NioProtocol.class.getName());
  connector.setPort(this.port);

  File baseDir = createTempDir("tomcat");
  String baseDirPath = baseDir.getAbsolutePath();

  this.tomcatServer = new Tomcat();
  this.tomcatServer.setBaseDir(baseDirPath);
  this.tomcatServer.setPort(this.port);
  this.tomcatServer.getService().addConnector(connector);
  this.tomcatServer.setConnector(connector);
 }
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:17,代码来源:TomcatWebSocketTestServer.java

示例10: customize

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
@Override
public void customize(ConfigurableEmbeddedServletContainer configurableEmbeddedServletContainer) {
    final String absoluteKeystoreFile;
    try {
        absoluteKeystoreFile = keystoreFile.getFile().getAbsolutePath();
        TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) configurableEmbeddedServletContainer;
        tomcat.addConnectorCustomizers(
                (connector) -> {
                    connector.setPort(port);
                    connector.setSecure(true);
                    connector.setScheme("https");

                    Http11NioProtocol proto = (Http11NioProtocol) connector.getProtocolHandler();
                    proto.setSSLEnabled(true);
                    proto.setKeystoreFile(absoluteKeystoreFile);
                    proto.setKeystorePass(keystorePass);
                    proto.setKeystoreType("PKCS12");
                    proto.setKeyAlias("tomcat");
                }
        );
    } catch (IOException e) {
    }
}
 
开发者ID:tsurelad,项目名称:Midaat-Vaccination-Microservice,代码行数:24,代码来源:SSLEnabledServletContainer.java

示例11: createSslConnector

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
private Connector createSslConnector() {
    if (sslConfig == null) {
        throw new IllegalStateException("SSL configuration not specified");
    }

    Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
    Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
    connector.setScheme("https");
    connector.setSecure(true);
    connector.setPort(sslConfig.getPort());
    protocol.setSSLEnabled(sslConfig.isEnable());
    protocol.setKeystoreFile(sslConfig.getKeystore());
    protocol.setKeystorePass(sslConfig.getKeystorePassword());
    protocol.setKeyAlias(sslConfig.getKeyAlias());

    logger.info(String.format("Initializing SSL connector on port %d", sslConfig.getPort()));
    return connector;
}
 
开发者ID:joeattardi,项目名称:tailstreamer,代码行数:19,代码来源:TomcatConfig.java

示例12: TomcatWebSocketTestServer

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
public TomcatWebSocketTestServer(int port) {

		this.port = port;

		Connector connector = new Connector(Http11NioProtocol.class.getName());
        connector.setPort(this.port);

        File baseDir = createTempDir("tomcat");
        String baseDirPath = baseDir.getAbsolutePath();

		this.tomcatServer = new Tomcat();
		this.tomcatServer.setBaseDir(baseDirPath);
		this.tomcatServer.setPort(this.port);
        this.tomcatServer.getService().addConnector(connector);
        this.tomcatServer.setConnector(connector);
	}
 
开发者ID:wieden-kennedy,项目名称:composite-framework,代码行数:17,代码来源:TomcatWebSocketTestServer.java

示例13: createSslConnector

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
private Connector createSslConnector() {
    Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
    Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
    final int httpsPort = Utils.getSystemPort(Constants.SYS_HTTPS_PORT);
    try {
        File keyStore = com.groupon.odo.proxylib.Utils.copyResourceToLocalFile("tomcat.ks", "tomcat.ks");
        connector.setScheme("https");
        connector.setSecure(true);
        connector.setPort(httpsPort);
        protocol.setSSLEnabled(true);
        protocol.setSslProtocol("TLS");
        protocol.setKeystoreFile(keyStore.getAbsolutePath());
        protocol.setKeystorePass("changeit");
        return connector;
    } catch (IOException ex) {
        throw new IllegalStateException("can't access keystore: [" + "keystore"
                                            + "] or truststore: [" + "keystore" + "]", ex);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:groupon,项目名称:odo,代码行数:23,代码来源:HttpProxyContainer.java

示例14: createSslConnector

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
private Connector createSslConnector() {
	Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
	Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
	try {
		connector.setScheme("https");
		connector.setSecure(true);
		connector.setPort(tlsPort);

		File keystore = getKeyStoreFile();
		File truststore = keystore;

		protocol.setSSLEnabled(true);
		protocol.setKeystoreFile(keystore.getAbsolutePath());
		protocol.setKeystorePass(sslKeystorePassword);
		protocol.setTruststoreFile(truststore.getAbsolutePath());
		protocol.setTruststorePass(sslKeystorePassword);
		protocol.setKeyAlias(sslKeystoreAlias);
		return connector;
	} catch (IOException ex) {
		throw new IllegalStateException(
				"can't access keystore: [" + "keystore" + "] or truststore: [" + "keystore" + "]", ex);
	}
}
 
开发者ID:arnaldop,项目名称:enhanced-pet-clinic,代码行数:24,代码来源:TomcatConfig.java

示例15: createSslConnector

import org.apache.coyote.http11.Http11NioProtocol; //导入依赖的package包/类
private Connector createSslConnector() {
    Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
    Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
    File keystore = null;
    File truststore = null;
    try {
        keystore = new DefaultResourceLoader().getResource(this.pathToKeystore).getFile(); //new ClassPathResource(pathToKeystore).getFile();
        truststore = new DefaultResourceLoader().getResource(pathToKeystore).getFile();
        connector.setScheme("https");
        connector.setSecure(true);
        connector.setPort(443);
        protocol.setSSLEnabled(true);
        protocol.setKeystoreFile(keystore.getAbsolutePath());
        protocol.setKeystorePass(this.sslKeystorePwd);
        protocol.setTruststoreFile(truststore.getAbsolutePath());
        protocol.setTruststorePass(this.sslKeystorePwd);
        protocol.setKeyAlias(this.sslKeyAlias);
        return connector;
    }catch (IOException ex) {
        throw new IllegalStateException("can't access keystore: [" + keystore
                + "] or truststore: [" + truststore + "]", ex);
    }
}
 
开发者ID:datenstrudel,项目名称:bulbs-core,代码行数:24,代码来源:BulbsCoreApp.java


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