@Override public boolean isRequestedSessionIdValid() { if (requestedSessionIdValid == null) { String sessionId = getRequestedSessionId(); SessionData sessionData = (sessionId != null) ? getSessionDataStorage().get(sessionId) : null; return isRequestedSessionIdValid(sessionData); } return super.isRequestedSessionIdValid(); }
public void commitSession(HttpServletResponse response) { // System.out.println("SessionHttpServletRequest.commitSession"); PippoHttpSession wrappedSession = currentSession; if (wrappedSession == null) { if (isInvalidateClientSession()) { getSessionStrategy().onInvalidatedSession(this, response); } } else { SessionData sessionData = wrappedSession.getSessionData(); getSessionDataStorage().save(sessionData); if (!isRequestedSessionIdValid() || !sessionData.getId().equals(getRequestedSessionId())) { getSessionStrategy().onNewSession(this, response, sessionData); } } }
@Override public HttpSession getSession(boolean create) { if (currentSession != null) { return currentSession; } String requestedSessionId = getRequestedSessionId(); if (requestedSessionId != null) { SessionData session = getSessionDataStorage().get(requestedSessionId); if (session != null) { requestedSessionIdValid = true; currentSession = createSession(session); currentSession.setNew(false); return currentSession; } } if (!create) { return null; } SessionData session = getSessionDataStorage().create(); currentSession = createSession(session); return currentSession; }