Package org.apache.catalina

Examples of org.apache.catalina.Session


   /**
    * {@inheritDoc}
    */
   public void expireSession(String sessionId)
   {
      Session session = findSession(sessionId);
      if (session != null)
         session.expire();
   }
View Full Code Here


   /**
    * {@inheritDoc}
    */
   public String getCreationTime(String sessionId)
   {
      Session session = findSession(sessionId);
      if(session == null)
      {
         log_.info("getCreationTime(): Session " + sessionId +
                       " not found");
         return "";
      }
     return new Date(session.getCreationTime()).toString();
   }
View Full Code Here

   /**
    * {@inheritDoc}
    */
   public String getLastAccessedTime(String sessionId)
   {
      Session session = findSession(sessionId);
      if(session == null) {
         log_.info("getLastAccessedTime(): Session " + sessionId +
                   " not found");
         return "";
      }
     return new Date(session.getLastAccessedTime()).toString();
   }
View Full Code Here

                  //if (osu.passivated && osu.owner == null)
                  if (osu.isPassivated())
                  {
                     // Passivated session needs to be expired. A call to
                     // findSession will bring it out of passivation
                     Session session = findSession(realId);
                     if (session != null)
                     {
                        session.isValid(); // will expire
                        continue;
                     }
                  }
                 
                  // If we get here either !osu.passivated, or we don't own
View Full Code Here

      boolean didPopulate = false;

      //let super class handle the authenticate().
      boolean alreadyAuthenticated = super.authenticate(request, response, config);

      Session session = request.getSessionInternal(false);
      if (session != null)
      {
         //get session note(used internally) to indicate if did populateSession.
         Boolean b = (Boolean) session.getNote(DID_POPULATE);
         if (b != null)
            didPopulate = b.booleanValue();
      }

      //if user not already authenticated and did populate not called..
      if (!alreadyAuthenticated && !didPopulate)
      {
         populateSession(request);
      }

      //remove the note since not needed anymore, if set.
      if (session != null)
         session.removeNote(DID_POPULATE);

      //pass return value on.
      return alreadyAuthenticated;
   }
View Full Code Here

    *
    * @param request Request we are processing
    */
   protected void populateSession(Request request)
   {
      Session session = request.getSessionInternal(false);

      //if there is a session to store data under...
      if (session != null)
      {
         HttpSession httpSession = session.getSession();

         if (trace)
            log.trace("SessionID: " + httpSession.getId());

         //store username.
         String username = request.getParameter(Constants.FORM_USERNAME);
         if (trace)
            log.trace("Setting " + Constants.FORM_USERNAME + " = " + username);
         httpSession.setAttribute(Constants.FORM_USERNAME, username);

         //store password if requested.
         if (includePassword)
         {
            String password = request.getParameter(Constants.FORM_PASSWORD);
            String displayPassword = (password == null ? " = null" : " = --hidden--");
            if (trace)
               log.trace("Setting " + Constants.FORM_PASSWORD + displayPassword);
            httpSession.setAttribute(Constants.FORM_PASSWORD, password);
         }

         //store SecurityAssociation context exception.
         Throwable t = SecurityAssociationActions.getAuthException();
         if (trace)
            log.trace("Setting " + LOGIN_EXCEPTION + " = " + t);
         httpSession.setAttribute(LOGIN_EXCEPTION, t);

         //finally, set a note so we do not do this again.
         session.setNote(DID_POPULATE, Boolean.TRUE);
      }
      else
      {
         if (trace)
            log.trace("No Session to store login parameters in");
View Full Code Here

     
      assertFalse("Passivation is disabled", mgr.isPassivationEnabled());
      assertEquals("Correct max active count", 2, mgr.getMaxActiveAllowed());
     
      // Set up a session
      Session sess1 = createAndUseSession(mgr, "1", true, true);
     
      assertEquals("Session count correct", 1, mgr.getActiveSessionCount());
      assertEquals("Local session count correct", 1, mgr.getLocalActiveSessionCount());
     
      createAndUseSession(mgr, "2", true, true);
     
      assertEquals("Session count correct", 2, mgr.getActiveSessionCount());
      assertEquals("Local session count correct", 2, mgr.getLocalActiveSessionCount());
     
      // Should fail to create a 3rd
      createAndUseSession(mgr, "3", false, false);
     
      // Confirm a session timeout clears space
      sess1.setMaxInactiveInterval(1);      
      SessionTestUtil.sleepThread(1100);     
     
      createAndUseSession(mgr, "3", true, true);     
     
      assertEquals("Session count correct", 2, mgr.getActiveSessionCount());
View Full Code Here

      assertEquals("Correct max active count", 1, mgr.getMaxActiveAllowed());
      assertEquals("Correct max idle time", 1, mgr.getPassivationMaxIdleTime());
      assertEquals("Correct min idle time", -1, mgr.getPassivationMinIdleTime());

      // Set up a session
      Session sess1 = createAndUseSession(mgr, "1", true, true);
     
      assertEquals("Session count correct", 1, mgr.getActiveSessionCount());
      assertEquals("Local session count correct", 1, mgr.getLocalActiveSessionCount());
     
      // Should fail to create a 2nd
      createAndUseSession(mgr, "2", false, false);
     
      // Confirm a session timeout clears space
      sess1.setMaxInactiveInterval(1);      
      SessionTestUtil.sleepThread(1100);     
     
      createAndUseSession(mgr, "2", true, true);     
     
      assertEquals("Session count correct", 1, mgr.getActiveSessionCount());
View Full Code Here

      assertEquals("Correct max active count", 1, mgr.getMaxActiveAllowed());
      assertEquals("Correct max idle time", 3, mgr.getPassivationMaxIdleTime());
      assertEquals("Correct min idle time", 1, mgr.getPassivationMinIdleTime());
     
      // Set up a session
      Session sess1 = createAndUseSession(mgr, "1", true, true);
     
      assertEquals("Session count correct", 1, mgr.getActiveSessionCount());
      assertEquals("Local session count correct", 1, mgr.getLocalActiveSessionCount());
     
      // Should fail to create a 2nd
      createAndUseSession(mgr, "2", false, false);
     
      // Confirm a session timeout clears space
      sess1.setMaxInactiveInterval(1);      
      SessionTestUtil.sleepThread(1100);     
     
      createAndUseSession(mgr, "2", true, false);     
     
      assertEquals("Session count correct", 1, mgr.getActiveSessionCount());
View Full Code Here

      assertEquals("Local session count correct", 1, mgr0.getLocalActiveSessionCount());     
      assertEquals("Session count correct", 0, mgr1.getActiveSessionCount());
      assertEquals("Local session count correct", 0, mgr1.getLocalActiveSessionCount());
     
      // Get it in-memory on mgr1 as well
      Session sess1 = useSession(mgr1, "1");
     
      // A 2nd session should fail
      createAndUseSession(mgr0, "2", false, false);
      createAndUseSession(mgr1, "2", false, false);
     
      // Confirm a session timeout clears space
      sess1.setMaxInactiveInterval(1);     
      useSession(mgr1, "1");  
      useSession(mgr0, "1");
      SessionTestUtil.sleepThread(mgr0.getMaxInactiveInterval() * 1000 + 100);     
     
      createAndUseSession(mgr0, "2", true, true);
View Full Code Here

TOP

Related Classes of org.apache.catalina.Session

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.