public String changeSessionId() { Method changeSessionIdMethod = getChangeSessionIdMethod(); if (changeSessionIdMethod == null) { return ""; } HttpServletRequest nonWrappedHttpServletRequest = getNonWrappedHttpServletRequest(); if (nonWrappedHttpServletRequest.getSession() == null) { throw new IllegalStateException("changeSessionId requested for request with no session"); } originalSessions.remove(nonWrappedHttpServletRequest.getSession().getId()); HazelcastHttpSession hazelcastHttpSession = getSession(false); sessions.remove(hazelcastHttpSession.getId()); hazelcastHttpSession.destroy(true); String newHazelcastSessionId = generateSessionId(); String newJSessionId = invokeChangeSessionId(nonWrappedHttpServletRequest, changeSessionIdMethod); HttpSession originalSession = nonWrappedHttpServletRequest.getSession(); HazelcastHttpSession hazelcastSession = createHazelcastHttpSession(newHazelcastSessionId, originalSession); hazelcastSession.setClusterWideNew(true); updateSessionMaps(newJSessionId, hazelcastSession); addSessionCookie(this, newHazelcastSessionId); return newJSessionId; }
@Override public final void doFilter(ServletRequest req, ServletResponse res, final FilterChain chain) throws IOException, ServletException { HazelcastRequestWrapper requestWrapper = new HazelcastRequestWrapper((HttpServletRequest) req, (HttpServletResponse) res); chain.doFilter(requestWrapper, res); HazelcastHttpSession session = requestWrapper.getSession(false); if (session != null && session.isValid() && config.isDeferredWrite()) { if (LOGGER.isFinestEnabled()) { LOGGER.finest("UPDATING SESSION " + session.getId()); } session.sessionDeferredWrite(); } }
@Override public final void doFilter(ServletRequest req, ServletResponse res, final FilterChain chain) throws IOException, ServletException { HazelcastRequestWrapper requestWrapper = new HazelcastRequestWrapper((HttpServletRequest) req, (HttpServletResponse) res); chain.doFilter(requestWrapper, res); HazelcastHttpSession session = requestWrapper.getSession(false); if (session != null && session.isValid() && config.isDeferredWrite()) { if (LOGGER.isFinestEnabled()) { LOGGER.finest("UPDATING SESSION " + session.getId()); } session.sessionDeferredWrite(); } }
@Override public HttpSession getSession() { return getSession(true); }
@Override public HttpSession getSession() { return getSession(true); }