Search in sources :

Example 21 with TomcatServletWebServerFactory

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

the class DefaultServletWebServerFactoryCustomizerTests method customTomcatMaxHttpPostSize.

@Test
public void customTomcatMaxHttpPostSize() {
    Map<String, String> map = new HashMap<>();
    map.put("server.tomcat.max-http-post-size", "10000");
    bindProperties(map);
    TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);
    this.customizer.customize(factory);
    TomcatWebServer embeddedFactory = (TomcatWebServer) factory.getWebServer();
    embeddedFactory.start();
    try {
        assertThat(embeddedFactory.getTomcat().getConnector().getMaxPostSize()).isEqualTo(10000);
    } finally {
        embeddedFactory.stop();
    }
}
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)

Aggregations

TomcatServletWebServerFactory (org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory)21 Test (org.junit.Test)16 HashMap (java.util.HashMap)13 AccessLogValve (org.apache.catalina.valves.AccessLogValve)7 TomcatWebServer (org.springframework.boot.web.embedded.tomcat.TomcatWebServer)5 Valve (org.apache.catalina.Valve)2 RemoteIpValve (org.apache.catalina.valves.RemoteIpValve)2 AbstractProtocol (org.apache.coyote.AbstractProtocol)2 UndertowServletWebServerFactory (org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory)2 ServletContext (javax.servlet.ServletContext)1 Context (org.apache.catalina.Context)1 ServerProperties (org.springframework.boot.autoconfigure.web.ServerProperties)1 JettyServletWebServerFactory (org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory)1 TomcatContextCustomizer (org.springframework.boot.web.embedded.tomcat.TomcatContextCustomizer)1 WebServer (org.springframework.boot.web.server.WebServer)1 AnnotationConfigServletWebServerApplicationContext (org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext)1 ExampleServlet (org.springframework.boot.web.servlet.server.ExampleServlet)1 InitParameterConfiguringServletContextInitializer (org.springframework.boot.web.servlet.server.InitParameterConfiguringServletContextInitializer)1 ServletWebServerFactory (org.springframework.boot.web.servlet.server.ServletWebServerFactory)1 ApplicationContext (org.springframework.context.ApplicationContext)1