use of org.apache.catalina.core.StandardWrapper in project geode by apache.
the class EmbeddedTomcat8 method addServlet.
public StandardWrapper addServlet(String path, String name, String clazz) throws ServletException {
StandardWrapper servlet = (StandardWrapper) rootContext.createWrapper();
servlet.setName(name);
servlet.setServletClass(clazz);
servlet.setLoadOnStartup(1);
rootContext.addChild(servlet);
rootContext.addServletMapping(path, name);
servlet.setParent(rootContext);
return servlet;
}
use of org.apache.catalina.core.StandardWrapper in project uavstack by uavorg.
the class SpringBootTomcatPlusIT method onServletStop.
/**
* onServletStop
*
* @param args
*/
@Override
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);
/**
* NOTE: spring boot rewrite the tomcat webappclassloader, makes the addURL for nothing, then we can't do
* anything on this we may use its webappclassloader's parent as the classloader
*/
context.put(InterceptConstants.WEBAPPLOADER, Thread.currentThread().getContextClassLoader().getParent());
context.put(InterceptConstants.CONTEXTPATH, sw.getServletContext().getContextPath());
iSupport.doIntercept(context);
}
use of org.apache.catalina.core.StandardWrapper in project uavstack by uavorg.
the class SpringBootTomcatPlusIT method onServletStart.
/**
* onServletStart
*
* @param args
*/
@Override
public void onServletStart(Object... args) {
StandardWrapper sw = (StandardWrapper) args[0];
Servlet servlet = (Servlet) args[1];
InterceptSupport iSupport = InterceptSupport.instance();
InterceptContext context = iSupport.createInterceptContext(Event.AFTER_SERVET_INIT);
context.put(InterceptConstants.SERVLET_INSTANCE, servlet);
/**
* NOTE: spring boot rewrite the tomcat webappclassloader, makes the addURL for nothing, then we can't do
* anything on this we may use its webappclassloader's parent as the classloader
*/
context.put(InterceptConstants.WEBAPPLOADER, Thread.currentThread().getContextClassLoader().getParent());
context.put(InterceptConstants.CONTEXTPATH, sw.getServletContext().getContextPath());
iSupport.doIntercept(context);
}
use of org.apache.catalina.core.StandardWrapper in project uavstack by uavorg.
the class TomcatPlusIT method onServletStart.
/**
* onServletStart
*
* @param args
*/
public void onServletStart(Object... args) {
StandardWrapper sw = (StandardWrapper) args[0];
Servlet servlet = (Servlet) args[1];
InterceptSupport iSupport = InterceptSupport.instance();
InterceptContext context = iSupport.createInterceptContext(Event.AFTER_SERVET_INIT);
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 tomcat by apache.
the class TestMultipartConfig method testPartialMultipartConfigMaxFileSize.
@Test
public void testPartialMultipartConfigMaxFileSize() throws Exception {
MultipartDef multipartDef = new MultipartDef();
multipartDef.setMaxFileSize("1024");
StandardWrapper servlet = config(multipartDef);
MultipartConfigElement mce = servlet.getMultipartConfigElement();
Assert.assertNotNull(mce);
Assert.assertEquals("", mce.getLocation());
Assert.assertEquals(1024, mce.getMaxFileSize());
Assert.assertEquals(-1, mce.getMaxRequestSize());
Assert.assertEquals(0, mce.getFileSizeThreshold());
}
Aggregations