Java Code Examples for org.apache.catalina.connector.Request#changeSessionId()

The following examples show how to use org.apache.catalina.connector.Request#changeSessionId() . 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: JvmRouteBinderValve.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Change Request Session id
 * @param request current request
 * @param sessionId
 *            original session id
 * @param newSessionID
 *            new session id for node migration
 */
protected void changeRequestSessionID(Request request, String sessionId, String newSessionID) {
    request.changeSessionId(newSessionID);

    // set original sessionid at request, to allow application detect the
    // change
    if (sessionIdAttribute != null && !"".equals(sessionIdAttribute)) {
        if (log.isDebugEnabled()) {
            log.debug(sm.getString("jvmRoute.set.orignalsessionid",sessionIdAttribute,sessionId));
        }
        request.setAttribute(sessionIdAttribute, sessionId);
    }
}
 
Example 2
Source File: JvmRouteBinderValve.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Change Request Session id
 * @param request current request
 * @param sessionId
 *            original session id
 * @param newSessionID
 *            new session id for node migration
 */
protected void changeRequestSessionID(Request request, String sessionId, String newSessionID) {
    request.changeSessionId(newSessionID);

    // set original sessionid at request, to allow application detect the
    // change
    if (sessionIdAttribute != null && !"".equals(sessionIdAttribute)) {
        if (log.isDebugEnabled()) {
            log.debug(sm.getString("jvmRoute.set.orignalsessionid",sessionIdAttribute,sessionId));
        }
        request.setAttribute(sessionIdAttribute, sessionId);
    }
}
 
Example 3
Source File: JvmRouteBinderValve.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Change Request Session id
 * @param request current request
 * @param sessionId
 *            original session id
 * @param newSessionID
 *            new session id for node migration
 */
protected void changeRequestSessionID(Request request, String sessionId, String newSessionID) {
    request.changeSessionId(newSessionID);

    // set original sessionid at request, to allow application detect the
    // change
    if (sessionIdAttribute != null && !"".equals(sessionIdAttribute)) {
        if (log.isDebugEnabled()) {
            log.debug(sm.getString("jvmRoute.set.orignalsessionid",sessionIdAttribute,sessionId));
        }
        request.setAttribute(sessionIdAttribute, sessionId);
    }
}
 
Example 4
Source File: TomcatRequestAuthenticator.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
protected String changeHttpSessionId(boolean create) {
    Request request = this.request;
    HttpSession session = request.getSession(false);
    if (session == null) {
        return request.getSession(true).getId();
    }
    if (!deployment.isTurnOffChangeSessionIdOnLogin()) return request.changeSessionId();
    else return session.getId();
}
 
Example 5
Source File: TomcatSamlSessionStore.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
protected String changeSessionId(Session session) {
    Request request = this.request;
    if (!deployment.turnOffChangeSessionIdOnLogin()) return request.changeSessionId();
    else return session.getId();
}