本文整理汇总了Java中org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.addAdditionalTomcatConnectors方法的典型用法代码示例。如果您正苦于以下问题:Java TomcatEmbeddedServletContainerFactory.addAdditionalTomcatConnectors方法的具体用法?Java TomcatEmbeddedServletContainerFactory.addAdditionalTomcatConnectors怎么用?Java TomcatEmbeddedServletContainerFactory.addAdditionalTomcatConnectors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory
的用法示例。
在下文中一共展示了TomcatEmbeddedServletContainerFactory.addAdditionalTomcatConnectors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureHttp
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
private void configureHttp(final TomcatEmbeddedServletContainerFactory tomcat) {
final CasServerProperties.Http http = casProperties.getServer().getHttp();
if (http.isEnabled()) {
LOGGER.debug("Creating HTTP configuration for the embedded tomcat container...");
final Connector connector = new Connector(http.getProtocol());
int port = http.getPort();
if (port <= 0) {
LOGGER.warn("No explicit port configuration is provided to CAS. Scanning for available ports...");
port = SocketUtils.findAvailableTcpPort();
}
LOGGER.info("Activated embedded tomcat container HTTP port to [{}]", port);
connector.setPort(port);
LOGGER.debug("Configuring embedded tomcat container for HTTP2 protocol support");
connector.addUpgradeProtocol(new Http2Protocol());
http.getAttributes().forEach(connector::setAttribute);
tomcat.addAdditionalTomcatConnectors(connector);
}
}
示例2: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
securityConstraint.addCollection(collection);
context.addConstraint(securityConstraint);
}
};
tomcat.addAdditionalTomcatConnectors(initiateHttpConnector());
return tomcat;
}
示例3: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
final TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
if (isEnabled()) {
final Connector ajpConnector = new Connector(getProtocol());
ajpConnector.setPort(getPort());
ajpConnector.setSecure(isSecure());
ajpConnector.setAllowTrace(isAllowTrace());
ajpConnector.setScheme(getScheme());
tomcat.addAdditionalTomcatConnectors(ajpConnector);
}
return tomcat;
}
示例4: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer(SslProperties properties) {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
securityConstraint.addCollection(collection);
context.addConstraint(securityConstraint);
}
};
tomcat.addAdditionalTomcatConnectors(createSslConnector(properties));
return tomcat;
}
示例5: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
final TomcatEmbeddedServletContainerFactory tomcatFactory = new TomcatEmbeddedServletContainerFactory();
// tomcatFactory.setAddress(InetAddress.getLocalHost());// you can restrict localhost access
tomcatFactory.setPort(8080);
// ServletContainerInitializer
final Connector connector = new Connector();
connector.setPort(8443);
connector.setSecure(true);
connector.setScheme("https");
connector.setProperty("SSLEnabled", "true");
connector.setProperty("keystorePass", "spring");
try {
final ClassPathResource classPathResource = new ClassPathResource("keystore");
System.err.println(classPathResource.getFile().getAbsolutePath());
connector.setProperty("keystoreFile", classPathResource.getFile().getAbsolutePath());
} catch (final Exception e) {
System.err.println("Error while loading classpath resource " + e.getMessage());
}
tomcatFactory.addAdditionalTomcatConnectors(connector);
return tomcatFactory;
}
示例6: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
/**
* <p>servletContainer.</p>
*
* @return a {@link org.springframework.boot.context.embedded.EmbeddedServletContainerFactory} object.
*/
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
securityConstraint.addCollection(collection);
context.addConstraint(securityConstraint);
}
};
tomcat.addAdditionalTomcatConnectors(initiateHttpConnector());
return tomcat;
}
示例7: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
securityConstraint.addCollection(collection);
context.addConstraint(securityConstraint);
}
};
tomcat.addAdditionalTomcatConnectors(initiateHttpConnector());
return tomcat;
}
示例8: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint constraint = new SecurityConstraint();
constraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
constraint.addCollection(collection);
context.addConstraint(constraint);
}
};
tomcat.addAdditionalTomcatConnectors(httpConnector());
return tomcat;
}
示例9: configureAjp
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
private void configureAjp(final TomcatEmbeddedServletContainerFactory tomcat) {
final CasServerProperties.Ajp ajp = casProperties.getServer().getAjp();
if (ajp.isEnabled() && ajp.getPort() > 0) {
LOGGER.debug("Creating AJP configuration for the embedded tomcat container...");
final Connector ajpConnector = new Connector(ajp.getProtocol());
ajpConnector.setProtocol(ajp.getProtocol());
ajpConnector.setPort(ajp.getPort());
ajpConnector.setSecure(ajp.isSecure());
ajpConnector.setAllowTrace(ajp.isAllowTrace());
ajpConnector.setScheme(ajp.getScheme());
if (ajp.getAsyncTimeout() > 0) {
ajpConnector.setAsyncTimeout(ajp.getAsyncTimeout());
}
ajpConnector.setEnableLookups(ajp.isEnableLookups());
if (ajp.getMaxPostSize() > 0) {
ajpConnector.setMaxPostSize(ajp.getMaxPostSize());
}
ajpConnector.addUpgradeProtocol(new Http2Protocol());
if (ajp.getProxyPort() > 0) {
LOGGER.debug("Set AJP proxy port to [{}]", ajp.getProxyPort());
ajpConnector.setProxyPort(ajp.getProxyPort());
}
if (ajp.getRedirectPort() > 0) {
LOGGER.debug("Set AJP redirect port to [{}]", ajp.getRedirectPort());
ajpConnector.setRedirectPort(ajp.getRedirectPort());
}
ajp.getAttributes().forEach(ajpConnector::setAttribute);
tomcat.addAdditionalTomcatConnectors(ajpConnector);
}
}
示例10: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
Connector[] additionalConnectors = this.additionalConnector();
if (additionalConnectors != null && additionalConnectors.length > 0) {
tomcat.addAdditionalTomcatConnectors(additionalConnectors);
}
return tomcat;
}
示例11: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
/**
* @return servletContainer bean reconfigured using SSL
*/
@Bean
public EmbeddedServletContainerFactory servletContainer() {
final TomcatEmbeddedServletContainerFactory tomcat =
new TomcatEmbeddedServletContainerFactory();
tomcat.addAdditionalTomcatConnectors(createHttpConnector());
return tomcat;
}
示例12: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
if (tomcatAjpEnabled) {
Connector ajpConnector = new Connector("AJP/1.3");
ajpConnector.setPort(ajpPort);
ajpConnector.setSecure(false);
ajpConnector.setAllowTrace(false);
ajpConnector.setScheme("http");
tomcat.addAdditionalTomcatConnectors(ajpConnector);
}
return tomcat;
}
示例13: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
/**
* adds SSL connector to Tomcat
*
* @return
*/
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
if (StringUtils.hasText(keystoreFile)) {
tomcat.addAdditionalTomcatConnectors(createSslConnector());
}
return tomcat;
}
示例14: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
tomcat.addAdditionalTomcatConnectors(createStandardConnector());
return tomcat;
}
示例15: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
tomcat.addAdditionalTomcatConnectors(createStandardConnector());
return tomcat;
}