Java Code Examples for org.apache.catalina.Session#getId()
The following examples show how to use
org.apache.catalina.Session#getId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Request.java From Tomcat8-Source-Read with MIT License | 6 votes |
/** * Changes the session ID of the session associated with this request. * * @return the old session ID before it was changed * @see javax.servlet.http.HttpSessionIdListener * @since Servlet 3.1 */ @Override public String changeSessionId() { Session session = this.getSessionInternal(false); if (session == null) { throw new IllegalStateException( sm.getString("coyoteRequest.changeSessionId")); } Manager manager = this.getContext().getManager(); manager.changeSessionId(session); String newSessionId = session.getId(); this.changeSessionId(newSessionId); return newSessionId; }
Example 2
Source File: DeltaManager.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
public void changeSessionId(Session session, boolean notify) { // original sessionID String orgSessionID = session.getId(); super.changeSessionId(session); if (notify && cluster.getMembers().length > 0) { // changed sessionID String newSessionID = session.getId(); try { // serialize sessionID byte[] data = serializeSessionId(newSessionID); // notify change sessionID SessionMessage msg = new SessionMessageImpl(getName(), SessionMessage.EVT_CHANGE_SESSION_ID, data, orgSessionID, orgSessionID + "-" + System.currentTimeMillis()); msg.setTimestamp(System.currentTimeMillis()); counterSend_EVT_CHANGE_SESSION_ID++; send(msg); } catch (IOException e) { log.error(sm.getString("deltaManager.unableSerializeSessionID", newSessionID), e); } } }
Example 3
Source File: DeltaManager.java From tomcatsrc with Apache License 2.0 | 6 votes |
public void changeSessionId(Session session, boolean notify) { // original sessionID String orgSessionID = session.getId(); super.changeSessionId(session); if (notify && cluster.getMembers().length > 0) { // changed sessionID String newSessionID = session.getId(); try { // serialize sessionID byte[] data = serializeSessionId(newSessionID); // notify change sessionID SessionMessage msg = new SessionMessageImpl(getName(), SessionMessage.EVT_CHANGE_SESSION_ID, data, orgSessionID, orgSessionID + "-" + System.currentTimeMillis()); msg.setTimestamp(System.currentTimeMillis()); counterSend_EVT_CHANGE_SESSION_ID++; send(msg); } catch (IOException e) { log.error(sm.getString("deltaManager.unableSerializeSessionID", newSessionID), e); } } }
Example 4
Source File: RedisSessionManager.java From redis-session-manager with Apache License 2.0 | 5 votes |
@Override protected void changeSessionId(Session session, String newId, boolean notifySessionListeners, boolean notifyContainerListeners) { final String oldId = session.getId(); super.changeSessionId(session, newId, notifySessionListeners, notifyContainerListeners); if (RedisSession.class.isAssignableFrom(session.getClass())) { final RedisSession rSession = RedisSession.class.cast(session); currentSessionState.set(new RedisSessionState(rSession, false)); getClient().delete(generateRedisSessionKey(oldId)); save(rSession, true); } else { throw new UnsupportedOperationException("Could not change a session ID with class " + session.getClass()); } }
Example 5
Source File: DeltaManager.java From Tomcat8-Source-Read with MIT License | 4 votes |
protected void changeSessionId(Session session, boolean notify) { String orgSessionID = session.getId(); super.changeSessionId(session); if (notify) sendChangeSessionId(session.getId(), orgSessionID); }
Example 6
Source File: DeltaManager.java From Tomcat8-Source-Read with MIT License | 4 votes |
protected void changeSessionId(Session session, String newId, boolean notify) { String orgSessionID = session.getId(); super.changeSessionId(session, newId); if (notify) sendChangeSessionId(session.getId(), orgSessionID); }
Example 7
Source File: SingleSignOnSessionKey.java From Tomcat8-Source-Read with MIT License | 4 votes |
public SingleSignOnSessionKey(Session session) { this.sessionId = session.getId(); Context context = session.getManager().getContext(); this.contextName = context.getName(); this.hostName = context.getParent().getName(); }
Example 8
Source File: SingleSignOnSessionKey.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
public SingleSignOnSessionKey(Session session) { this.sessionId = session.getId(); Context context = (Context) session.getManager().getContainer(); this.contextName = context.getName(); this.hostName = context.getParent().getName(); }
Example 9
Source File: SingleSignOnSessionKey.java From tomcatsrc with Apache License 2.0 | 4 votes |
public SingleSignOnSessionKey(Session session) { this.sessionId = session.getId(); Context context = (Context) session.getManager().getContainer(); this.contextName = context.getName(); this.hostName = context.getParent().getName(); }
Example 10
Source File: RedisStoreTest.java From session-managers with Apache License 2.0 | 4 votes |
private String getRedisSessionId(Session session) { return SESSIONS_KEY + session.getId(); }
Example 11
Source File: TomcatSamlSessionStore.java From keycloak with Apache License 2.0 | 4 votes |
@Override protected String changeSessionId(Session session) { Request request = this.request; if (!deployment.turnOffChangeSessionIdOnLogin()) return request.changeSessionId(); else return session.getId(); }
Example 12
Source File: CatalinaSamlSessionStore.java From keycloak with Apache License 2.0 | 4 votes |
protected String changeSessionId(Session session) { return session.getId(); }
Example 13
Source File: RedisStore.java From session-managers with Apache License 2.0 | 2 votes |
/** * * @param session * @return The session Id + the session prefix */ private String getRedisSessionId(final Session session) { return getSessionKeyPrefix() + session.getId() ; }