use of org.directwebremoting.util.FakeServletContext in project ma-core-public by infiniteautomation.
the class StartupUtil method outOfContainerInit.
/**
* A way to setup DWR outside of any Containers.
* This method can also serve as a template for in container code wanting
* to get DWR setup. Callers of this method should clean up after themselves
* by calling {@link #outOfContainerDestroy(Container)}
* @return A new initialized container.
* @throws ServletException If the setup fails.
*/
public Container outOfContainerInit() throws ServletException {
try {
ServletConfig servletConfig = new FakeServletConfig("test", new FakeServletContext());
ServletContext servletContext = servletConfig.getServletContext();
StartupUtil.setupLogging(servletConfig, null);
StartupUtil.logStartup(servletConfig);
DefaultContainer container = ContainerUtil.createDefaultContainer(servletConfig);
ContainerUtil.setupDefaultContainer(container, servletConfig);
WebContextBuilder webContextBuilder = StartupUtil.initWebContext(servletConfig, servletContext, container);
StartupUtil.initServerContext(servletConfig, servletContext, container);
ContainerUtil.prepareForWebContextFilter(servletContext, servletConfig, container, webContextBuilder, null);
ContainerUtil.configureContainerFully(container, servletConfig);
ContainerUtil.publishContainer(container, servletConfig);
return container;
} catch (ServletException ex) {
throw ex;
} catch (Exception ex) {
throw new ServletException(ex);
}
}
Aggregations