use of org.apache.catalina.core.StandardWrapper in project uavstack by uavorg.
the class TomcatPlusIT method onServletStop.
/**
* onServletStop
*
* @param args
*/
public void onServletStop(Object... args) {
StandardWrapper sw = (StandardWrapper) args[0];
Servlet servlet = (Servlet) args[1];
InterceptSupport iSupport = InterceptSupport.instance();
InterceptContext context = iSupport.createInterceptContext(Event.BEFORE_SERVLET_DESTROY);
context.put(InterceptConstants.SERVLET_INSTANCE, servlet);
context.put(InterceptConstants.WEBAPPLOADER, Thread.currentThread().getContextClassLoader());
context.put(InterceptConstants.CONTEXTPATH, sw.getServletContext().getContextPath());
iSupport.doIntercept(context);
}
use of org.apache.catalina.core.StandardWrapper in project spring-boot by spring-projects.
the class LocalDevToolsAutoConfigurationTests method devToolsSwitchesJspServletToDevelopmentMode.
@Test
void devToolsSwitchesJspServletToDevelopmentMode() throws Exception {
this.context = getContext(() -> initializeAndRun(Config.class));
TomcatWebServer tomcatContainer = (TomcatWebServer) ((ServletWebServerApplicationContext) this.context).getWebServer();
Container context = tomcatContainer.getTomcat().getHost().findChildren()[0];
StandardWrapper jspServletWrapper = (StandardWrapper) context.findChild("jsp");
EmbeddedServletOptions options = (EmbeddedServletOptions) ReflectionTestUtils.getField(jspServletWrapper.getServlet(), "options");
assertThat(options.getDevelopment()).isTrue();
}
use of org.apache.catalina.core.StandardWrapper in project tomcat by apache.
the class TestMultipartConfig method testCompleteMultipartConfig.
@Test
public void testCompleteMultipartConfig() throws Exception {
MultipartDef multipartDef = new MultipartDef();
multipartDef.setMaxFileSize("1024");
multipartDef.setMaxRequestSize("10240");
multipartDef.setFileSizeThreshold("24");
multipartDef.setLocation("/tmp/foo");
StandardWrapper servlet = config(multipartDef);
MultipartConfigElement mce = servlet.getMultipartConfigElement();
Assert.assertNotNull(mce);
Assert.assertEquals("/tmp/foo", mce.getLocation());
Assert.assertEquals(1024, mce.getMaxFileSize());
Assert.assertEquals(10240, mce.getMaxRequestSize());
Assert.assertEquals(24, mce.getFileSizeThreshold());
}
use of org.apache.catalina.core.StandardWrapper in project tomcat by apache.
the class TestMultipartConfig method testNoMultipartConfig.
@Test
public void testNoMultipartConfig() throws Exception {
StandardWrapper servlet = config(null);
MultipartConfigElement mce = servlet.getMultipartConfigElement();
Assert.assertNull(mce);
}
use of org.apache.catalina.core.StandardWrapper in project tomcat by apache.
the class TestMultipartConfig method config.
private StandardWrapper config(MultipartDef multipartDef) throws Exception {
MyContextConfig config = new MyContextConfig();
WebXml webxml = new WebXml();
ServletDef servletDef = new ServletDef();
servletDef.setServletName("test");
servletDef.setServletClass("org.apache.catalina.startup.ParamServlet");
servletDef.setMultipartDef(multipartDef);
webxml.addServlet(servletDef);
Method m = ContextConfig.class.getDeclaredMethod("configureContext", WebXml.class);
// Force our way in
m.setAccessible(true);
m.invoke(config, webxml);
StandardWrapper servlet = (StandardWrapper) config.getContext().findChild("test");
return servlet;
}
Aggregations