use of org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory in project seldon-core by SeldonIO.
the class TomcatConfig method servletContainer.
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
Connector[] additionalConnectors = this.additionalConnector();
if (additionalConnectors != null && additionalConnectors.length > 0) {
tomcat.addAdditionalTomcatConnectors(additionalConnectors);
}
return tomcat;
}
use of org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory in project gpconnect-demonstrator by nhsconnect.
the class RestConfig method servletContainer.
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat;
if (enableHsts && httpPort != null && httpPort > 0) {
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);
}
};
} else {
tomcat = new TomcatEmbeddedServletContainerFactory();
}
tomcat.addAdditionalTomcatConnectors(createHttpConnector());
return tomcat;
}
use of org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory in project apollo by ctripcorp.
the class TomcatContainerCustomizer method customize.
@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);
}
}
});
}
use of org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory in project webanno by webanno.
the class WebAnno method servletContainer.
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
if (ajpPort > 0) {
Connector ajpConnector = new Connector(PROTOCOL);
ajpConnector.setPort(ajpPort);
tomcat.addAdditionalTomcatConnectors(ajpConnector);
}
return tomcat;
}
use of org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory in project spring-boot-examples by ityouknow.
the class FileUploadWebApplication method tomcatEmbedded.
// Tomcat large file upload connection reset
@Bean
public TomcatEmbeddedServletContainerFactory tomcatEmbedded() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
tomcat.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
if ((connector.getProtocolHandler() instanceof AbstractHttp11Protocol<?>)) {
((AbstractHttp11Protocol<?>) connector.getProtocolHandler()).setMaxSwallowSize(-1);
}
});
return tomcat;
}
Aggregations