Exemplo n.º 1
0
  protected void finishRequest() throws IOException {
    SessionImpl session = _session;
    //
    if (session == null && getSessionId() != null) session = (SessionImpl) getSession(false);

    if (session != null) session.finishRequest();
  }
Exemplo n.º 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;
  }
Exemplo n.º 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);
  }
Exemplo n.º 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;
  }
Exemplo n.º 5
0
 void saveSession() {
   SessionImpl session = _session;
   if (session != null) session.save();
 }
Exemplo n.º 6
0
 /**
  * Returns the current session.
  *
  * @return the current session
  */
 public HttpSession getLoadedSession() {
   if (_session != null && _session.isValid()) return _session;
   else return null;
 }