コード例 #1
0
  protected void finishRequest() throws IOException {
    SessionImpl session = _session;
    //
    if (session == null && getSessionId() != null) session = (SessionImpl) getSession(false);

    if (session != null) session.finishRequest();
  }
コード例 #2
0
  /**
   * Returns the current session.
   *
   * <p>XXX: duplicated in RequestAdapter
   *
   * @param create true if a new session should be created
   * @return the current session
   */
  private SessionImpl createSession(boolean create) {
    SessionManager manager = getSessionManager();

    if (manager == null) return null;

    String id = getSessionId();

    long now = Alarm.getCurrentTime();

    SessionImpl session = manager.createSession(create, this, id, now, isSessionIdFromCookie());

    if (session != null
        && (id == null || !session.getId().equals(id))
        && manager.enableSessionCookies()) {
      setSessionId(session.getId());
    }

    // server/0123 vs TCK
    /*
    if (session != null)
      session.setAccessTime(now);
      */

    return session;
  }
コード例 #3
0
  /** Returns true if the HTTP request's session id refers to a valid session. */
  public boolean isRequestedSessionIdValid() {
    String id = getRequestedSessionId();

    if (id == null) return false;

    SessionImpl session = _session;

    if (session == null) session = (SessionImpl) getSession(false);

    return session != null && session.isValid() && session.getId().equals(id);
  }
コード例 #4
0
  /**
   * Returns the current session.
   *
   * @param create true if a new session should be created
   * @return the current session
   */
  public HttpSession getSession(boolean create) {
    if (_session != null) {
      if (_session.isValid()) return _session;
    } else if (!create && _sessionIsLoaded) return null;

    _sessionIsLoaded = true;

    _session = createSession(create);

    return _session;
  }
コード例 #5
0
 void saveSession() {
   SessionImpl session = _session;
   if (session != null) session.save();
 }
コード例 #6
0
 /**
  * Returns the current session.
  *
  * @return the current session
  */
 public HttpSession getLoadedSession() {
   if (_session != null && _session.isValid()) return _session;
   else return null;
 }