use of org.eclipse.jetty.server.session.HouseKeeper in project ddf by codice.
the class JettySessionManagementTest method setupClass.
@BeforeClass
public static void setupClass() throws Exception {
// To get the AccessRequestLog to log in the target folder
System.setProperty("ddf.data", "target");
server = new Server();
HandlerList handlers = new HandlerList();
server.setHandler(handlers);
// Configure server according to the jetty.xml file
XmlConfiguration configuration = new XmlConfiguration(JettySessionManagementTest.class.getResourceAsStream("/jetty-session.xml"));
configuration.configure(server);
// Have server bind to first available port
ServerConnector connector = new ServerConnector(server);
connector.setPort(0);
server.addConnector(connector);
ServletContextHandler context = new ServletContextHandler(null, "/context1", ServletContextHandler.SESSIONS);
context.addServlet(new ServletHolder(new TestServlet()), "/");
context.getSessionHandler().setMaxInactiveInterval(MAX_INACTIVE_INTERVAL_SECONDS);
handlers.addHandler(context);
ServletContextHandler context2 = new ServletContextHandler(null, "/context2", ServletContextHandler.SESSIONS);
context2.addServlet(new ServletHolder(new TestServlet()), "/");
context2.getSessionHandler().setMaxInactiveInterval(MAX_INACTIVE_INTERVAL_SECONDS);
handlers.addHandler(context2);
HouseKeeper houseKeeper = new HouseKeeper();
houseKeeper.setIntervalSec(SCAVENGE_INTERVAL_SECONDS);
server.getSessionIdManager().setSessionHouseKeeper(houseKeeper);
server.start();
port = connector.getLocalPort();
}
Aggregations