Search in sources :

Example 1 with MessageServlet

use of io.undertow.servlet.test.util.MessageServlet in project undertow by undertow-io.

the class RequestListenerAsyncRequestTestCase method setup.

@BeforeClass
public static void setup() throws ServletException {
    final PathHandler root = new PathHandler();
    final ServletContainer container = ServletContainer.Factory.newInstance();
    ServletInfo m = new ServletInfo("messageServlet", MessageServlet.class).addInitParam(MessageServlet.MESSAGE, HELLO_WORLD).setAsyncSupported(true).addMapping("/message");
    ServletInfo a = new ServletInfo("asyncServlet", AsyncServlet.class).addInitParam(MessageServlet.MESSAGE, HELLO_WORLD).setAsyncSupported(true).addMapping("/async");
    ServletInfo a2 = new ServletInfo("asyncServlet2", AnotherAsyncServlet.class).setAsyncSupported(true).addMapping("/async2");
    DeploymentInfo builder = new DeploymentInfo().setClassLoader(SimpleServletTestCase.class.getClassLoader()).setContextPath("/servletContext").setClassIntrospecter(TestClassIntrospector.INSTANCE).setDeploymentName("servletContext.war").addServlets(m, a, a2).addListener(new ListenerInfo(TestListener.class));
    DeploymentManager manager = container.addDeployment(builder);
    manager.deploy();
    root.addPrefixPath(builder.getContextPath(), manager.start());
    DefaultServer.setRootHandler(root);
}
Also used : ServletInfo(io.undertow.servlet.api.ServletInfo) ListenerInfo(io.undertow.servlet.api.ListenerInfo) DeploymentManager(io.undertow.servlet.api.DeploymentManager) ServletContainer(io.undertow.servlet.api.ServletContainer) PathHandler(io.undertow.server.handlers.PathHandler) TestListener(io.undertow.servlet.test.util.TestListener) DeploymentInfo(io.undertow.servlet.api.DeploymentInfo) MessageServlet(io.undertow.servlet.test.util.MessageServlet) BeforeClass(org.junit.BeforeClass)

Aggregations

PathHandler (io.undertow.server.handlers.PathHandler)1 DeploymentInfo (io.undertow.servlet.api.DeploymentInfo)1 DeploymentManager (io.undertow.servlet.api.DeploymentManager)1 ListenerInfo (io.undertow.servlet.api.ListenerInfo)1 ServletContainer (io.undertow.servlet.api.ServletContainer)1 ServletInfo (io.undertow.servlet.api.ServletInfo)1 MessageServlet (io.undertow.servlet.test.util.MessageServlet)1 TestListener (io.undertow.servlet.test.util.TestListener)1 BeforeClass (org.junit.BeforeClass)1