private void configureSession(WebAppContext context) { SessionHandler handler = context.getSessionHandler(); Duration sessionTimeout = getSession().getTimeout(); handler.setMaxInactiveInterval( isNegative(sessionTimeout) ? -1 : (int) sessionTimeout.getSeconds()); if (getSession().isPersistent()) { DefaultSessionCache cache = new DefaultSessionCache(handler); FileSessionDataStore store = new FileSessionDataStore(); store.setStoreDir(getValidSessionStoreDir()); cache.setSessionDataStore(store); handler.setSessionCache(cache); } }
public void setSessionDataStore(SessionDataStoreFactory sessionDataStoreFactory) throws Exception { SessionCache sessionCache = getSessionCache(); if (sessionCache != null) { sessionCache.setSessionDataStore(sessionDataStoreFactory.getSessionDataStore(this)); } else { sessionCache = new DefaultSessionCache(this); sessionCache.setSessionDataStore(sessionDataStoreFactory.getSessionDataStore(this)); setSessionCache(sessionCache); } }
/** * @see org.eclipse.jetty.server.session.SessionCacheFactory#getSessionCache(org.eclipse.jetty.server.session.SessionHandler) */ @Override public SessionCache getSessionCache (SessionHandler handler) { DefaultSessionCache cache = new DefaultSessionCache(handler); cache.setEvictionPolicy(getEvictionPolicy()); cache.setSaveOnInactiveEviction(isSaveOnInactiveEvict()); cache.setSaveOnCreate(isSaveOnCreate()); cache.setRemoveUnloadableSessions(isRemoveUnloadableSessions()); return cache; }
setSessionCache(ssFactory != null?ssFactory.getSessionCache(this):new DefaultSessionCache(this)); SessionDataStore sds = null; SessionDataStoreFactory sdsFactory = server.getBean(SessionDataStoreFactory.class);