本文整理了Java中org.apache.catalina.connector.Connector.setSecure()
方法的一些代码示例,展示了Connector.setSecure()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connector.setSecure()
方法的具体详情如下:
包路径:org.apache.catalina.connector.Connector
类名称:Connector
方法名:setSecure
[英]Set the secure connection flag that will be assigned to requests received through this connector.
[中]设置将分配给通过此连接器接收的请求的安全连接标志。
代码示例来源:origin: org.springframework.boot/spring-boot
@Override
public void customize(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, this.ssl,
this.sslStoreProvider);
connector.setScheme("https");
connector.setSecure(true);
}
代码示例来源:origin: OryxProject/oryx
connector.setSecure(false);
connector.setScheme("http");
connector.setSecure(true);
connector.setScheme("https");
connector.setAttribute("SSLEnabled", "true");
代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat6
@Persistent(manageable=false)
public void setSecure(boolean secure) {
connector.setSecure(secure);
}
代码示例来源:origin: pippo-java/pippo
private void enableSSLConnector(Tomcat tomcat) {
log.info("Using https protocol");
Connector connector = tomcat.getConnector();
connector.setPort(getSettings().getPort());
connector.setSecure(true);
connector.setScheme("https");
connector.setAttribute("keyAlias", getSettings().getKeyAlias());
connector.setAttribute("keystorePass", getSettings().getKeystorePassword());
connector.setAttribute("keystoreType", getSettings().getKeyType());
connector.setAttribute("keystoreFile", getSettings().getKeystoreFile());
connector.setAttribute("clientAuth", getSettings().getClientAuth());
if (getSettings().getClientAuth()) {
connector.setAttribute("truststoreFile", getSettings().getTruststoreFile());
connector.setAttribute("truststorePass", getSettings().getTruststorePassword());
}
connector.setAttribute("protocol", "HTTP/1.1");
connector.setAttribute("sslProtocol", "TLS");
connector.setAttribute("maxThreads", getSettings().getMaxConnections());
connector.setAttribute("protocol", "org.apache.coyote.http11.Http11AprProtocol");
connector.setAttribute("SSLEnabled", true);
}
代码示例来源:origin: org.crazyyak.dev/yak-dev-embedded-tomcat
private Connector createSecureAjpConnector(int securePort){
System.out.println("Creating secured AJP connector on port " + securePort);
Connector connector = new Connector(org.apache.coyote.ajp.AjpNioProtocol.class.getName());
connector.setPort(securePort);
connector.setScheme("https");
connector.setSecure(true);
return connector;
}
代码示例来源:origin: org.crazyyak.embedded/yak-embedded-tomcat
private Connector createSecureAjpConnector(int securePort){
System.out.println("Creating secured AJP connector on port " + securePort);
Connector connector = new Connector(org.apache.coyote.ajp.AjpNioProtocol.class.getName());
connector.setPort(securePort);
connector.setScheme("https");
connector.setSecure(true);
return connector;
}
代码示例来源:origin: miyakowork/NoteBlog
@Bean
public Connector httpConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setScheme("http");
//Connector监听的http的端口号
connector.setPort(environment.getProperty("server.http.port", Integer.class, 80));
connector.setSecure(false);
//监听到http的端口号后转向到的https的端口号
connector.setRedirectPort(environment.getProperty("server.port", Integer.class, 443));
return connector;
}
}
代码示例来源:origin: org.crazyyak.embedded/yak-embedded-tomcat
private Connector createAjpConnector(int port, int securePort){
System.out.println("Creating standard AJP connector on port " + port);
Connector connector = new Connector(org.apache.coyote.ajp.AjpNioProtocol.class.getName());
connector.setPort(port);
connector.setScheme("http");
connector.setSecure(false);
if (securePort > 0) {
connector.setRedirectPort(securePort);
}
return connector;
}
代码示例来源:origin: org.crazyyak.dev/yak-dev-embedded-tomcat
private Connector createAjpConnector(int port, int securePort){
System.out.println("Creating standard AJP connector on port " + port);
Connector connector = new Connector(org.apache.coyote.ajp.AjpNioProtocol.class.getName());
connector.setPort(port);
connector.setScheme("http");
connector.setSecure(false);
if (securePort > 0) {
connector.setRedirectPort(securePort);
}
return connector;
}
代码示例来源:origin: je-ge/spring-boot
@Bean
public Connector httpConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setScheme("http");
// 表示用8080端口来供http访问
connector.setPort(8080);
connector.setSecure(false);
// 自动重定向到8443端口
connector.setRedirectPort(8443);
return connector;
}
}
代码示例来源:origin: com.oath.microservices/micro-tomcat
private void addSSL(Connector connector) {
try {
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);
}
} catch (BeanNotOfRequiredTypeException e) {
}
}
代码示例来源:origin: sivaprasadreddy/jcart
private Connector initiateHttpConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setScheme("http");
connector.setPort(9090);
connector.setSecure(false);
connector.setRedirectPort(serverPort);
return connector;
}
}
代码示例来源:origin: sivaprasadreddy/jcart
private Connector initiateHttpConnector()
{
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setScheme("http");
connector.setPort(8080);
connector.setSecure(false);
connector.setRedirectPort(serverPort);
return connector;
}
代码示例来源:origin: openbaton/NFVO
private Connector initiateHttpConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setScheme("http");
connector.setPort(8080);
if (https) {
connector.setSecure(false);
connector.setRedirectPort(8443);
}
return connector;
}
}
代码示例来源:origin: metatron-app/metatron-discovery
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
if (tomcatAjpEnabled) {
Connector ajpConnector = new Connector(ajpProtocol);
ajpConnector.setPort(ajpPort);
ajpConnector.setSecure(false);
ajpConnector.setAllowTrace(false);
ajpConnector.setScheme("http");
tomcat.addAdditionalTomcatConnectors(ajpConnector);
}
return tomcat;
}
代码示例来源:origin: micromata/projectforge
private Connector createAJPConnector()
{
final Connector ajpConnector = new Connector("AJP/1.3");
ajpConnector.setPort(ajpPort);
ajpConnector.setAttribute("address", "127.0.0.1");
ajpConnector.setSecure(false);
ajpConnector.setAllowTrace(false);
ajpConnector.setScheme("http");
return ajpConnector;
}
}
代码示例来源:origin: mcekovic/tennis-crystal-ball
private void naiveHTTPSConnectorCustomizer(Connector connector) {
connector.setScheme("https");
connector.setSecure(true);
ProtocolHandler protocol = connector.getProtocolHandler();
if (protocol instanceof AbstractHttp11Protocol) {
AbstractHttp11Protocol httpProtocol = (AbstractHttp11Protocol)protocol;
httpProtocol.setSSLEnabled(true);
httpProtocol.setSSLDisableCompression(false);
sslProperties.customizeProtocol(httpProtocol);
}
}
代码示例来源:origin: Apress/beg-spring-boot-2
private Connector initiateHttpConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setScheme("http");
connector.setPort(8080);
connector.setSecure(false);
connector.setRedirectPort(serverPort);
//Tomcat maxSwallowSize sets to 2MB by default.
//To set the maxSwallowSize property of Tomcat https://tomcat.apache.org/tomcat-8.0-doc/config/http.html
//http://stackoverflow.com/questions/35748022/multipart-file-maximum-size-exception-spring-boot-embbeded-tomcat
((AbstractHttp11Protocol<?>) connector.getProtocolHandler()).setMaxSwallowSize(11534336);
return connector;
}
代码示例来源:origin: mcekovic/tennis-crystal-ball
private void addRedirectConnector() {
Connector connector = new Connector();
connector.setScheme("http");
connector.setPort(sslProperties.getRedirectFromPort());
connector.setSecure(false);
connector.setRedirectPort(getPort() > 0 ? getPort() : 0);
addAdditionalTomcatConnectors(connector);
}
}
代码示例来源:origin: org.visallo/visallo-tomcat-server
private void setupSslHandling(Connector connector) {
connector.setPort(super.getHttpsPort());
connector.setSecure(true);
connector.setScheme("https");
connector.setAttribute("keystoreFile", super.getKeyStorePath());
connector.setAttribute("keystorePass", super.getKeyStorePassword());
connector.setAttribute("keystoreType", super.getKeyStoreType());
connector.setAttribute("truststoreFile", super.getTrustStorePath());
connector.setAttribute("truststorePass", super.getTrustStorePassword());
connector.setAttribute("truststoreType", super.getTrustStoreType());
connector.setAttribute("sslProtocol", "TLS");
connector.setAttribute("SSLEnabled", true);
}
内容来源于网络,如有侵权,请联系作者删除!