/** * Create a new HttpSession for a request */ public HttpSession newHttpSession(HttpServletRequest request) { Session session=newSession(request); session.setMaxInactiveInterval(_dftMaxIdleSecs); addSession(session,true); return session; }
public void doStop() throws Exception { if (_storeDir != null) saveSessions(); super.doStop(); _sessions.clear(); _sessions=null; // stop the scavenger synchronized(this) { if (_saveTask!=null) _saveTask.cancel(); if (_task!=null) _task.cancel(); if (_timer!=null) _timer.cancel(); _timer=null; } }
public Cookie getSessionCookie(HttpSession session, String contextPath, boolean requestIsSecure) { if (isUsingCookies()) { String id = getNodeId(session); Cookie cookie=getHttpOnly()?new HttpOnlyCookie(_sessionCookie,id):new Cookie(_sessionCookie,id); cookie.setPath((contextPath==null||contextPath.length()==0)?"/":contextPath); cookie.setMaxAge(getMaxCookieAge()); cookie.setSecure(requestIsSecure&&getSecureCookies()); // set up the overrides if (_sessionDomain!=null) cookie.setDomain(_sessionDomain); if (_sessionPath!=null) cookie.setPath(_sessionPath); return cookie; } return null; }
public HttpSession getHttpSession(String nodeId) { String cluster_id = getIdManager().getClusterId(nodeId); synchronized (this) { Session session = getSession(cluster_id); if (session!=null && !session.getNodeId().equals(nodeId)) session.setIdChanged(true); return session; } }
if (sm instanceof AbstractSessionManager) { AbstractSessionManager asm = (AbstractSessionManager) sm; asm.setHttpOnly(true); asm.setSecureCookies(true); if (sm instanceof AbstractSessionManager) { AbstractSessionManager asm = (AbstractSessionManager) sm; asm.setHttpOnly(true); asm.setSecureCookies(true);
public Cookie access(HttpSession session,boolean secure) { long now=System.currentTimeMillis(); Session s = ((SessionIf)session).getSession(); s.access(now); // Do we need to refresh the cookie? if (isUsingCookies() && (s.isIdChanged() || (getMaxCookieAge()>0 && getRefreshCookieAge()>0 && ((now-s.getCookieSetTime())/1000>getRefreshCookieAge())) ) ) { Cookie cookie=getSessionCookie(session,_context.getContextPath(),secure); s.cookieSet(); s.setIdChanged(false); return cookie; } return null; }
/** * Add the session Registers the session with this manager and registers the * session ID with the sessionIDManager; */ protected void addSession(Session session, boolean created) { synchronized (_sessionIdManager) { _sessionIdManager.addSession(session); synchronized (this) { addSession(session); if (getSessions()>this._maxSessions) this._maxSessions=getSessions(); } } if (!created) { session.didActivate(); } else if (_sessionListeners!=null) { HttpSessionEvent event=new HttpSessionEvent(session); for (int i=0; i<LazyList.size(_sessionListeners); i++) ((HttpSessionListener)LazyList.get(_sessionListeners,i)).sessionCreated(event); } }
/** * @deprecated use {@link #getIdManager()} */ public SessionIdManager getMetaManager() { return getIdManager(); }
public void doStart() throws Exception { _sessions=new HashMap(); super.doStart(); _timer=new Timer(true); setScavengePeriod(getScavengePeriod()); if (_storeDir!=null) { if (!_storeDir.exists()) _storeDir.mkdir(); restoreSessions(); } setSavePeriod(getSavePeriod()); }
if (sm instanceof AbstractSessionManager) { AbstractSessionManager asm = (AbstractSessionManager)sm; asm.setHttpOnly(true); asm.setSecureCookies(true);
if (sm instanceof AbstractSessionManager) { AbstractSessionManager asm = (AbstractSessionManager)sm; asm.setHttpOnly(true); asm.setSecureCookies(true);
if (sm instanceof AbstractSessionManager) { AbstractSessionManager asm = (AbstractSessionManager)sm; asm.setHttpOnly(true); asm.setSecureCookies(true);