use of org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory in project spring-thymeleaf-simplefinance by heitkergm.
the class Application method servletWebServer.
/**
* This sets up the embedded tomcat server.
*
* @return the customized embedded tomcat server
*/
@Bean
public TomcatServletWebServerFactory servletWebServer() {
TomcatServletWebServerFactory tomcat;
tomcat = new TomcatServletWebServerFactoryImpl();
tomcat.addConnectorCustomizers((TomcatConnectorCustomizer) (final Connector connector) -> {
connector.setRedirectPort(8443);
});
tomcat.addAdditionalTomcatConnectors(createSSLConnector());
return tomcat;
}
use of org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory in project joinfaces by joinfaces.
the class TomcatAutoConfigurationTest method customize.
@Test
public void customize() {
TomcatServletWebServerFactory tomcatFactory = new TomcatServletWebServerFactory();
this.tomcatAutoConfiguration.jsfTomcatFactoryCustomizer().customize(tomcatFactory);
assertThat(tomcatFactory.getTomcatContextCustomizers()).isNotEmpty();
}
use of org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory in project cas by apereo.
the class X509TomcatServletWebServiceFactoryCustomizer method customize.
@Override
public void customize(final ConfigurableServletWebServerFactory factory) {
val webflow = casProperties.getAuthn().getX509().getWebflow();
if (factory instanceof TomcatServletWebServerFactory && webflow.getPort() > 0) {
val tomcat = (TomcatServletWebServerFactory) factory;
LOGGER.debug("Creating X509 configuration for the tomcat container...");
val connector = new Connector("HTTP/1.1");
connector.setPort(webflow.getPort());
connector.setScheme("https");
connector.setSecure(true);
connector.setAllowTrace(true);
val protocol = (AbstractHttp11JsseProtocol) connector.getProtocolHandler();
protocol.setSSLEnabled(true);
protocol.setSslProtocol("TLS");
protocol.setClientAuth(webflow.getClientAuth());
protocol.setKeystoreFile(serverProperties.getSsl().getKeyStore());
protocol.setKeystorePass(serverProperties.getSsl().getKeyStorePassword());
protocol.setTruststoreFile(serverProperties.getSsl().getTrustStore());
protocol.setTruststorePass(serverProperties.getSsl().getTrustStorePassword());
tomcat.addAdditionalTomcatConnectors(connector);
}
}
use of org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory in project spring-boot by spring-projects.
the class TomcatWebServerFactoryCustomizerTests method accessLogMaxDaysDefault.
@Test
void accessLogMaxDaysDefault() {
bind("server.tomcat.accesslog.enabled=true");
TomcatServletWebServerFactory factory = customizeAndGetFactory();
assertThat(((AccessLogValve) factory.getEngineValves().iterator().next()).getMaxDays()).isEqualTo(this.serverProperties.getTomcat().getAccesslog().getMaxDays());
}
use of org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory in project spring-boot by spring-projects.
the class TomcatWebServerFactoryCustomizerTests method accessLogConditionCanBeSpecified.
@Test
void accessLogConditionCanBeSpecified() {
bind("server.tomcat.accesslog.enabled=true", "server.tomcat.accesslog.conditionIf=foo", "server.tomcat.accesslog.conditionUnless=bar");
TomcatServletWebServerFactory factory = customizeAndGetFactory();
assertThat(((AccessLogValve) factory.getEngineValves().iterator().next()).getConditionIf()).isEqualTo("foo");
assertThat(((AccessLogValve) factory.getEngineValves().iterator().next()).getConditionUnless()).isEqualTo("bar");
assertThat(((AccessLogValve) factory.getEngineValves().iterator().next()).getCondition()).describedAs("value of condition should equal conditionUnless - provided for backwards compatibility").isEqualTo("bar");
}
Aggregations