Package com.caucho.server.session

Examples of com.caucho.server.session.SessionImpl


      return true;

    boolean isEmpty = true;
    for (int i = sessions.size() - 1; i >= 0; i--) {
      SoftReference<SessionImpl> ref = sessions.get(i);
      SessionImpl session = ref.get();

      try {
        if (session == timeoutSession) {
          sessions.remove(i);
          // session.logout();
View Full Code Here


    ArrayList<SoftReference<SessionImpl>> sessions = _sessions;
    _sessions = null;
     
    for (int i = 0; sessions != null && i < sessions.size(); i++) {
      SoftReference<SessionImpl> ref = sessions.get(i);
      SessionImpl session = ref.get();

      try {
        if (session != null) {
          // session.logout();
          session.invalidateLogout()// #599,  server/12i3
        }
      } catch (Exception e) {
        log.log(Level.WARNING, e.toString(), e);
      }
    }
View Full Code Here

        setHasCookie();

      return hSession;
    }
    else {
      SessionImpl oldSession = _session;
      _session = createSession(create, oldSession != null);
    }

    if (_session != null)
      setHasCookie();
View Full Code Here

    String id = getRequestedSessionId();

    long now = Alarm.getCurrentTime();

    SessionImpl session;

    if (id != null && id.length() > 6) {
      session = manager.getSession(id, now, create,
                                   isRequestedSessionIdFromCookie());
      if (session == null) {
      }
      else if (session.isValid()) {
        if (session != null)
          setHasCookie();
        if (! session.getId().equals(id) && manager.enableSessionCookies()) {
          HttpServletResponse response = getResponse();

          if (response instanceof CauchoResponse)
            ((CauchoResponse) getResponse()).setSessionId(session.getId());
        }

        return session;
      }
    }
    else
      id = null;

    if (! create)
      return null;

    // Must accept old ids because different webApps in the same
    // server must share the same cookie
    //
    // But, if the session group doesn't match, then create a new
    // session.

    session = manager.createSession(id, now, this,
                                    isRequestedSessionIdFromCookie());

    if (session != null)
      setHasCookie();

    if (session.getId().equals(id))
      return session;

    if (manager.enableSessionCookies()) {
      HttpServletResponse response = getResponse();

      if (response instanceof CauchoResponse)
        ((CauchoResponse) getResponse()).setSessionId(session.getId());
    }

    return session;
  }
View Full Code Here

   * Cleans up at the end of the request
   */
  public void finishRequest()
    throws IOException
  {
    SessionImpl session = _session;
    _session = null;

    if (session != null)
      session.finishRequest();
  }
View Full Code Here

   */
  protected Principal findSavedUser(HttpServletRequest request)
  {
    SingleSignon singleSignon = getSingleSignon();

    SessionImpl session = (SessionImpl) request.getSession(false);

    String sessionId;

    if (session != null)
      sessionId = session.getId();
    else
      sessionId = request.getRequestedSessionId();

    if (sessionId == null)
      return null;
    else if (singleSignon != null) {
      Principal user = singleSignon.get(sessionId);
     
      if (user != null && log.isLoggable(Level.FINER))
        log.finer(this + " load user '" + user + "' from " + singleSignon);
     
      return user;
    }
    else if (isSessionSaveLogin() && session != null) {
      Principal user = (Principal) session.getAttribute(LOGIN_USER_PRINCIPAL);
     
      if (user != null && log.isLoggable(Level.FINER))
        log.finer(this + " load user '" + user + "' from session");
     
      return user;
View Full Code Here

  protected void saveUser(HttpServletRequest request,
                          Principal user)
  {
    SingleSignon singleSignon = getSingleSignon();

    SessionImpl session;

    if (isSessionSaveLogin())
      session = (SessionImpl) request.getSession(true);
    else
      session = (SessionImpl) request.getSession(false);

    String sessionId;

    if (session != null)
      sessionId = session.getId();
    else
      sessionId = request.getRequestedSessionId();

    if (sessionId == null) {
    }
    else if (singleSignon != null) {
      singleSignon.put(sessionId, user);
     
      if (log.isLoggable(Level.FINER))
        log.finer(this + " save user '" + user +"' in single signon " + singleSignon);
    }
    else if (isSessionSaveLogin()) {
      session.setAttribute(LOGIN_USER_PRINCIPAL, user);
     
      if (log.isLoggable(Level.FINER))
        log.finer(this + " save user '" + user +"' in session " + singleSignon);
    }
  }
View Full Code Here

        return true;

      boolean isEmpty = true;
      for (int i = sessions.size() - 1; i >= 0; i--) {
        SoftReference<SessionImpl> ref = sessions.get(i);
        SessionImpl session = ref.get();

        try {
          if (session == timeoutSession) {
            sessions.remove(i);
            // session.logout();
View Full Code Here

      ArrayList<SoftReference<SessionImpl>> sessions = _sessions;
      _sessions = null;

      for (int i = 0; sessions != null && i < sessions.size(); i++) {
        SoftReference<SessionImpl> ref = sessions.get(i);
        SessionImpl session = ref.get();

        try {
          if (session != null) {
            // session.logout();
            session.invalidateLogout()// #599,  server/12i3
          }
        } catch (Exception e) {
          log.log(Level.WARNING, e.toString(), e);
        }
      }
View Full Code Here

    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);
  }
View Full Code Here

TOP

Related Classes of com.caucho.server.session.SessionImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.