staticContext.setServer( getJetty() ); staticContext.setContextPath( mountPoint ); staticContext.setSessionHandler( sessionHandler ); staticContext.setInitParameter( "org.eclipse.jetty.servlet.Default.dirAllowed", "false" ); URL resourceLoc = getClass().getClassLoader().getResource( contentLocation );
public WebAppContext addWebAppContext(String warPath, String contextPath) throws Exception { WebAppContext context = new WebAppContext(_contexts, warPath, contextPath); SessionHandler sessionHandler = newSessionHandler(); sessionHandler.setSessionIdManager(_sessionIdManager); sessionHandler.setMaxInactiveInterval(_maxInactivePeriod); context.setSessionHandler(sessionHandler); return context; }
protected void applySessionHandler(final WebAppContext webapp) { final String jettyCluster = context.getProperty(JettyRedisSession.JETTY_CLUSTER); if (StringUtils.isNotBlank(jettyCluster)) { setSessionIdManager(createRedisSessionIdManager(jettyCluster)); webapp.setSessionHandler(new SessionHandler(createRedisSessionManager(jettyCluster))); } }
private void persistSession(WebAppContext webApp) { String storeDir = getStoreDir(); SessionManager sm = webApp.getSessionHandler().getSessionManager(); if (sm instanceof HashSessionManager) { ((HashSessionManager)sm).setStoreDirectory(new File(storeDir)); return ; } HashSessionManager hsm = new HashSessionManager(); hsm.setStoreDirectory(new File(storeDir)); SessionHandler sh = new SessionHandler(); sh.setSessionManager(hsm); webApp.setSessionHandler(sh); }
staticContext.setServer( getJetty() ); staticContext.setContextPath( mountPoint ); staticContext.setSessionHandler( sessionHandler ); staticContext.setInitParameter( "org.eclipse.jetty.servlet.Default.dirAllowed", "false" ); URL resourceLoc = getClass().getClassLoader().getResource( contentLocation );
webAppContext.setContextPath(this.getContextPath()); webAppContext.setWar(getWebAppDir().getAbsolutePath()); webAppContext.setSessionHandler(new HashSessionManager().getSessionHandler()); webAppContext.setMaxFormContentSize(MAX_FORM_CONTENT_SIZE);
private JettyRunner configureClusteredJetty(String name, int port) throws Exception { JettyRunner runner = new JettyRunner(); runner.configure("src/test/cluster", "", port, port + 100); JDBCSessionIdManager idMgr = new JDBCSessionIdManager(runner.getServer()); idMgr.setWorkerName(name); idMgr.setDriverInfo("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:clustertest"); Server server = runner.getServer(); server.setSessionIdManager(idMgr); WebAppContext wac = (WebAppContext) server.getHandler(); JDBCSessionManager jdbcMgr = new JDBCSessionManager(); jdbcMgr.setIdManager(server.getSessionIdManager()); // force the session to be read from the database with no delay // This is an incorrectly documented feature. jdbcMgr.setSaveInterval(0); wac.setSessionHandler(new SessionHandler(jdbcMgr)); wac.getServletContext().setInitParameter("cluster.name", name); runner.start(); return runner; }