SimpleServlets v5.5.0

com.simpleservlets.pageprocessor
Class Session

java.lang.Object
  extended by com.simpleservlets.pageprocessor.Session

public class Session
extends Object

Encapsulates information about a user's session including the session id, the current sequence, and can store session-specific key-value pairs.

Author:
Paul Hyde

Nested Class Summary
static class Session.Manager
           
 
Field Summary
static int DEFAULT_TIMEOUT
           
static int NEVER_TIMEOUT
           
 
Method Summary
 long getIdleTime()
          Returns the difference between 'now' and the 'last used time'.
 int getIdleTimeoutMinutes()
           
 String getIdString()
           
 long getLastUsedTime()
          Returns the time that this session last sent a response.
 int getSequence()
           
 ValueMap getSessionStore()
          Returns the ValueMap that can be used to store session-specific information.
 Value getSessionValue(String sessionStoreKey)
           
 void invalidate()
          Removes this session from the list of sessions that the Session.Manager is monitoring.
 boolean isNew()
          Returns true if this session was just created and hasn't been seen by the client yet.
 boolean isReload()
          Returns true if the sequence sent up does not match the last sequence sent down.
 void setIdleTimeoutMinutes(int minutes)
          Used to specify a shorter or longer timeout for this session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEVER_TIMEOUT

public static final int NEVER_TIMEOUT
See Also:
Constant Field Values

DEFAULT_TIMEOUT

public static final int DEFAULT_TIMEOUT
See Also:
Constant Field Values
Method Detail

getIdString

public String getIdString()

getSequence

public int getSequence()

getLastUsedTime

public long getLastUsedTime()
Returns the time that this session last sent a response. While in request/response cycle, this method shows the last time that a response was sent—potentially from another concurrent thread.


getIdleTime

public long getIdleTime()
Returns the difference between 'now' and the 'last used time'.


isReload

public boolean isReload()
Returns true if the sequence sent up does not match the last sequence sent down.


isNew

public boolean isNew()
Returns true if this session was just created and hasn't been seen by the client yet.


setIdleTimeoutMinutes

public void setIdleTimeoutMinutes(int minutes)
Used to specify a shorter or longer timeout for this session. The default timeout comes from session manager.


getIdleTimeoutMinutes

public int getIdleTimeoutMinutes()

invalidate

public void invalidate()
Removes this session from the list of sessions that the Session.Manager is monitoring. This session can continue to be used for the rest of the request—even to generate URI's—but subsequent request will not find this session, and a new session will be created.


getSessionStore

public ValueMap getSessionStore()
Returns the ValueMap that can be used to store session-specific information. This activity on this ValueMap is synchronized independently of the Session it belongs to (use the getLockObject() method on ValueMap if you need to perform multiple operations on the ValueMap that must be done without interference).


getSessionValue

public Value getSessionValue(String sessionStoreKey)

SimpleServlets v5.5.0

Copyright © 2001-2007 Programix Incorporated. All rights reserved. SimpleServlets is free and is OSI Certified Open Source Software under the BSD license.