Search in sources :

Example 1 with TomcatServletWebServerFactory

use of org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory in project spring-boot by spring-projects.

the class DefaultServletWebServerFactoryCustomizerTests method tomcatAccessLogFileDateFormatByDefault.

@Test
public void tomcatAccessLogFileDateFormatByDefault() {
    TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
    Map<String, String> map = new HashMap<String, String>();
    map.put("server.tomcat.accesslog.enabled", "true");
    bindProperties(map);
    this.customizer.customize(factory);
    assertThat(((AccessLogValve) factory.getEngineValves().iterator().next()).getFileDateFormat()).isEqualTo(".yyyy-MM-dd");
}
Also used : TomcatServletWebServerFactory(org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory) HashMap(java.util.HashMap) AccessLogValve(org.apache.catalina.valves.AccessLogValve) Test(org.junit.Test)

Example 2 with TomcatServletWebServerFactory

use of org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory in project spring-boot by spring-projects.

the class DefaultServletWebServerFactoryCustomizerTests method testCustomTomcatTldSkip.

private void testCustomTomcatTldSkip(String... expectedJars) {
    TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
    this.customizer.customize(factory);
    assertThat(factory.getTldSkipPatterns()).contains(expectedJars);
    assertThat(factory.getTldSkipPatterns()).contains("junit-*.jar", "spring-boot-*.jar");
}
Also used : TomcatServletWebServerFactory(org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory)

Example 3 with TomcatServletWebServerFactory

use of org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory in project spring-boot by spring-projects.

the class DefaultServletWebServerFactoryCustomizerTests method customTomcatBackgroundProcessorDelay.

@Test
public void customTomcatBackgroundProcessorDelay() throws Exception {
    Map<String, String> map = new HashMap<>();
    map.put("server.tomcat.background-processor-delay", "5");
    bindProperties(map);
    TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
    this.customizer.customize(factory);
    assertThat(((TomcatWebServer) factory.getWebServer()).getTomcat().getEngine().getBackgroundProcessorDelay()).isEqualTo(5);
}
Also used : TomcatServletWebServerFactory(org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory) TomcatWebServer(org.springframework.boot.web.embedded.tomcat.TomcatWebServer) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 4 with TomcatServletWebServerFactory

use of org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory in project spring-boot by spring-projects.

the class DefaultServletWebServerFactoryCustomizerTests method tomcatAccessLogIsBufferedByDefault.

@Test
public void tomcatAccessLogIsBufferedByDefault() {
    TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
    Map<String, String> map = new HashMap<>();
    map.put("server.tomcat.accesslog.enabled", "true");
    bindProperties(map);
    this.customizer.customize(factory);
    assertThat(((AccessLogValve) factory.getEngineValves().iterator().next()).isBuffered()).isTrue();
}
Also used : TomcatServletWebServerFactory(org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory) HashMap(java.util.HashMap) AccessLogValve(org.apache.catalina.valves.AccessLogValve) Test(org.junit.Test)

Example 5 with TomcatServletWebServerFactory

use of org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory in project spring-boot by spring-projects.

the class DefaultServletWebServerFactoryCustomizerTests method defaultTomcatBackgroundProcessorDelay.

@Test
public void defaultTomcatBackgroundProcessorDelay() throws Exception {
    TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
    this.customizer.customize(factory);
    assertThat(((TomcatWebServer) factory.getWebServer()).getTomcat().getEngine().getBackgroundProcessorDelay()).isEqualTo(30);
}
Also used : TomcatServletWebServerFactory(org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory) TomcatWebServer(org.springframework.boot.web.embedded.tomcat.TomcatWebServer) Test(org.junit.Test)

Aggregations

TomcatServletWebServerFactory (org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory)66 Test (org.junit.jupiter.api.Test)28 AccessLogValve (org.apache.catalina.valves.AccessLogValve)24 Test (org.junit.Test)18 HashMap (java.util.HashMap)13 Bean (org.springframework.context.annotation.Bean)9 WebApplicationContextRunner (org.springframework.boot.test.context.runner.WebApplicationContextRunner)6 TomcatWebServer (org.springframework.boot.web.embedded.tomcat.TomcatWebServer)6 Connector (org.apache.catalina.connector.Connector)5 Valve (org.apache.catalina.Valve)4 RemoteIpValve (org.apache.catalina.valves.RemoteIpValve)4 Context (org.apache.catalina.Context)3 TomcatContextCustomizer (org.springframework.boot.web.embedded.tomcat.TomcatContextCustomizer)3 UndertowServletWebServerFactory (org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory)3 AnnotationConfigServletWebServerApplicationContext (org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext)3 ApplicationContext (org.springframework.context.ApplicationContext)3 ServletContext (jakarta.servlet.ServletContext)2 lombok.val (lombok.val)2 ErrorReportValve (org.apache.catalina.valves.ErrorReportValve)2 AbstractProtocol (org.apache.coyote.AbstractProtocol)2