Search in sources :

Example 16 with StandardWrapper

use of org.apache.catalina.core.StandardWrapper in project tomcat by apache.

the class TestMultipartConfig method testDefaultMultipartConfig.

@Test
public void testDefaultMultipartConfig() throws Exception {
    MultipartDef multipartDef = new MultipartDef();
    // Do not set any attributes on multipartDef: expect defaults
    StandardWrapper servlet = config(multipartDef);
    MultipartConfigElement mce = servlet.getMultipartConfigElement();
    Assert.assertNotNull(mce);
    Assert.assertEquals("", mce.getLocation());
    Assert.assertEquals(-1, mce.getMaxFileSize());
    Assert.assertEquals(-1, mce.getMaxRequestSize());
    Assert.assertEquals(0, mce.getFileSizeThreshold());
}
Also used : MultipartConfigElement(jakarta.servlet.MultipartConfigElement) MultipartDef(org.apache.tomcat.util.descriptor.web.MultipartDef) StandardWrapper(org.apache.catalina.core.StandardWrapper) Test(org.junit.Test)

Example 17 with StandardWrapper

use of org.apache.catalina.core.StandardWrapper in project tomcat by apache.

the class TestMultipartConfig method testPartialMultipartConfigMaxRequestSize.

@Test
public void testPartialMultipartConfigMaxRequestSize() throws Exception {
    MultipartDef multipartDef = new MultipartDef();
    multipartDef.setMaxRequestSize("10240");
    StandardWrapper servlet = config(multipartDef);
    MultipartConfigElement mce = servlet.getMultipartConfigElement();
    Assert.assertNotNull(mce);
    Assert.assertEquals("", mce.getLocation());
    Assert.assertEquals(-1, mce.getMaxFileSize());
    Assert.assertEquals(10240, mce.getMaxRequestSize());
    Assert.assertEquals(0, mce.getFileSizeThreshold());
}
Also used : MultipartConfigElement(jakarta.servlet.MultipartConfigElement) MultipartDef(org.apache.tomcat.util.descriptor.web.MultipartDef) StandardWrapper(org.apache.catalina.core.StandardWrapper) Test(org.junit.Test)

Example 18 with StandardWrapper

use of org.apache.catalina.core.StandardWrapper in project tomcat by apache.

the class TestMultipartConfig method testPartialMultipartConfigFileSizeThreshold.

@Test
public void testPartialMultipartConfigFileSizeThreshold() throws Exception {
    MultipartDef multipartDef = new MultipartDef();
    multipartDef.setFileSizeThreshold("24");
    StandardWrapper servlet = config(multipartDef);
    MultipartConfigElement mce = servlet.getMultipartConfigElement();
    Assert.assertNotNull(mce);
    Assert.assertEquals("", mce.getLocation());
    Assert.assertEquals(-1, mce.getMaxFileSize());
    Assert.assertEquals(-1, mce.getMaxRequestSize());
    Assert.assertEquals(24, mce.getFileSizeThreshold());
}
Also used : MultipartConfigElement(jakarta.servlet.MultipartConfigElement) MultipartDef(org.apache.tomcat.util.descriptor.web.MultipartDef) StandardWrapper(org.apache.catalina.core.StandardWrapper) Test(org.junit.Test)

Example 19 with StandardWrapper

use of org.apache.catalina.core.StandardWrapper in project tomcat by apache.

the class TestMapper method createWrapper.

private Wrapper createWrapper(String name) {
    Wrapper wrapper = new StandardWrapper();
    wrapper.setName(name);
    return wrapper;
}
Also used : Wrapper(org.apache.catalina.Wrapper) StandardWrapper(org.apache.catalina.core.StandardWrapper) StandardWrapper(org.apache.catalina.core.StandardWrapper)

Example 20 with StandardWrapper

use of org.apache.catalina.core.StandardWrapper in project spring-boot by spring-projects.

the class TomcatServletWebServerFactoryTests method getJspServlet.

@Override
protected JspServlet getJspServlet() throws ServletException {
    Tomcat tomcat = ((TomcatWebServer) this.webServer).getTomcat();
    Container container = tomcat.getHost().findChildren()[0];
    StandardWrapper standardWrapper = (StandardWrapper) container.findChild("jsp");
    if (standardWrapper == null) {
        return null;
    }
    standardWrapper.load();
    return (JspServlet) standardWrapper.getServlet();
}
Also used : Tomcat(org.apache.catalina.startup.Tomcat) Container(org.apache.catalina.Container) JspServlet(org.apache.jasper.servlet.JspServlet) StandardWrapper(org.apache.catalina.core.StandardWrapper)

Aggregations

StandardWrapper (org.apache.catalina.core.StandardWrapper)23 MultipartConfigElement (jakarta.servlet.MultipartConfigElement)6 Test (org.junit.Test)6 Container (org.apache.catalina.Container)5 MultipartDef (org.apache.tomcat.util.descriptor.web.MultipartDef)5 InterceptSupport (com.creditease.monitor.interceptframework.InterceptSupport)4 InterceptContext (com.creditease.monitor.interceptframework.spi.InterceptContext)4 Servlet (javax.servlet.Servlet)4 HashMap (java.util.HashMap)3 Wrapper (org.apache.catalina.Wrapper)3 WebContainer (com.sun.enterprise.web.WebContainer)2 IOException (java.io.IOException)2 StandardContext (org.apache.catalina.core.StandardContext)2 WebAppInfo (org.apache.openejb.assembler.classic.WebAppInfo)2 VirtualServer (com.sun.enterprise.config.serverbeans.VirtualServer)1 WebModule (com.sun.enterprise.web.WebModule)1 Method (java.lang.reflect.Method)1 MalformedURLException (java.net.MalformedURLException)1 Enumeration (java.util.Enumeration)1 Map (java.util.Map)1