org.apache.catalina.connector.Request.changeSessionId()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(194)

本文整理了Java中org.apache.catalina.connector.Request.changeSessionId方法的一些代码示例,展示了Request.changeSessionId的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.changeSessionId方法的具体详情如下:
包路径:org.apache.catalina.connector.Request
类名称:Request
方法名:changeSessionId

Request.changeSessionId介绍

[英]Changes the session ID of the session associated with this request.
[中]更改与此请求关联的会话的会话ID。

代码示例

代码示例来源:origin: apache/geode

request.changeSessionId(newSessionId);

代码示例来源:origin: magro/memcached-session-manager

@Test
public final void testChangeSessionIdForRelocatedSession() throws IOException, ServletException {
  final String sessionId = "bar";
  final String newSessionId = "newId";
  when( _request.getRequestedSessionId() ).thenReturn( sessionId );
  when( _service.changeSessionIdOnMemcachedFailover( eq( sessionId ) ) ).thenReturn( newSessionId );
  _sessionTrackerValve.invoke( _request, _response );
  verify( _request ).changeSessionId( eq( newSessionId ) );
  verify(_request).setNote(eq(RequestTrackingHostValve.SESSION_ID_CHANGED), eq(Boolean.TRUE));
}

代码示例来源:origin: magro/memcached-session-manager

/**
 * If there's a session for a requested session id that is taken over (tomcat failover) or
 * that will be relocated (memcached failover), the new session id will be set (via {@link Request#changeSessionId(String)}).
 *
 * @param request the request
 * @param response the response
 *
 * @return <code>true</code> if the id of a valid session was changed.
 *
 * @see Request#changeSessionId(String)
 */
private boolean changeRequestedSessionId( final Request request, final Response response ) {
  /*
   * Check for session relocation only if a session id was requested
   */
  if ( request.getRequestedSessionId() != null ) {
    String newSessionId = _sessionBackupService.changeSessionIdOnTomcatFailover( request.getRequestedSessionId() );
    if ( newSessionId == null ) {
      newSessionId = _sessionBackupService.changeSessionIdOnMemcachedFailover( request.getRequestedSessionId() );
    }
    if ( newSessionId != null ) {
      request.changeSessionId( newSessionId );
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.glassfish.main.web/web-core

public String run() {
    return request.changeSessionId();
  }
}

代码示例来源:origin: org.glassfish.main.security/websecurity

public String changeSessionId() {
  return httpRequest.changeSessionId();
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
public String changeSessionId() {
  if (request == null) {
    throw new IllegalStateException(
            sm.getString("requestFacade.nullRequest"));
  }
  return request.changeSessionId();
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
public String changeSessionId() {
  if (request == null) {
    throw new IllegalStateException(
            sm.getString("requestFacade.nullRequest"));
  }
  return request.changeSessionId();
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
public String changeSessionId() {
  if (request == null) {
    throw new IllegalStateException(
            sm.getString("requestFacade.nullRequest"));
  }
  return request.changeSessionId();
}

代码示例来源:origin: org.glassfish.main.web/web-core

@Override
public String changeSessionId() {
  if (request == null) {
    throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
  }
  if (SecurityUtil.isPackageProtectionEnabled()){
    return AccessController.
        doPrivileged(new ChangeSessionIdPrivilegedAction());
  } else {
    return request.changeSessionId();
  }
}

代码示例来源:origin: org.keycloak/spring-boot-container-bundle

@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();
  }
}

代码示例来源:origin: org.keycloak/keycloak-saml-tomcat8-adapter

@Override
  protected String changeSessionId(Session session) {
    Request request = this.request;
    if (!deployment.turnOffChangeSessionIdOnLogin()) return request.changeSessionId();
    else return session.getId();
  }
}

代码示例来源:origin: org.apache.geode/geode-modules

request.changeSessionId(newSessionId);

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * 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);
  }
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina-ha

/**
 * 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);
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina-ha

/**
 * 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);
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * 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;
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * 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;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * 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;
}

代码示例来源:origin: de.javakaffee.msm/memcached-session-manager

/**
 * If there's a session for a requested session id that is taken over (tomcat failover) or
 * that will be relocated (memcached failover), the new session id will be set (via {@link Request#changeSessionId(String)}).
 *
 * @param request the request
 * @param response the response
 *
 * @return <code>true</code> if the id of a valid session was changed.
 *
 * @see Request#changeSessionId(String)
 */
private boolean changeRequestedSessionId( final Request request, final Response response ) {
  /*
   * Check for session relocation only if a session id was requested
   */
  if ( request.getRequestedSessionId() != null ) {
    String newSessionId = _sessionBackupService.changeSessionIdOnTomcatFailover( request.getRequestedSessionId() );
    if ( newSessionId == null ) {
      newSessionId = _sessionBackupService.changeSessionIdOnMemcachedFailover( request.getRequestedSessionId() );
    }
    if ( newSessionId != null ) {
      request.changeSessionId( newSessionId );
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.jboss.web/jbossweb

Manager manager = request.getContext().getManager();
manager.changeSessionId(session, request.getRandom());
request.changeSessionId(session.getId());

相关文章

Request类方法