use of io.undertow.server.session.InMemorySessionManager in project undertow by undertow-io.
the class CrossContextServletSharedSessionTestCase method setup.
@BeforeClass
public static void setup() throws ServletException {
final ServletContainer container = ServletContainer.Factory.newInstance();
final PathHandler path = new PathHandler();
DefaultServer.setRootHandler(path);
InMemorySessionManager manager = new InMemorySessionManager("test");
createDeployment("1", container, path, manager);
createDeployment("2", container, path, manager);
}
use of io.undertow.server.session.InMemorySessionManager in project undertow by undertow-io.
the class CrossContextServletSharedSessionTestCase method createDeployment.
private static void createDeployment(final String name, final ServletContainer container, final PathHandler path, InMemorySessionManager sessionManager) throws ServletException {
ServletInfo s = new ServletInfo("servlet", SessionServlet.class).addMapping("/servlet");
ServletInfo forward = new ServletInfo("forward", ForwardServlet.class).addMapping("/forward");
ServletInfo include = new ServletInfo("include", IncludeServlet.class).addMapping("/include");
ServletInfo includeAdd = new ServletInfo("includeadd", IncludeAddServlet.class).addMapping("/includeadd");
ServletInfo forwardAdd = new ServletInfo("forwardadd", ForwardAddServlet.class).addMapping("/forwardadd");
ServletInfo accessTimeServlet = new ServletInfo("accesstimeservlet", LastAccessTimeSessionServlet.class).addMapping("/accesstimeservlet");
DeploymentInfo builder = new DeploymentInfo().setClassLoader(SimpleServletTestCase.class.getClassLoader()).setContextPath("/" + name).setClassIntrospecter(TestClassIntrospector.INSTANCE).setDeploymentName(name + ".war").setSessionManagerFactory(new SessionManagerFactory() {
@Override
public SessionManager createSessionManager(Deployment deployment) {
return sessionManager;
}
}).setServletSessionConfig(new ServletSessionConfig().setPath("/")).addServlets(s, forward, include, forwardAdd, includeAdd, accessTimeServlet);
DeploymentManager manager = container.addDeployment(builder);
manager.deploy();
path.addPrefixPath(builder.getContextPath(), manager.start());
}
Aggregations