public class SessionImpl extends java.lang.Object implements HttpSession, CacheListener
| Modifier and Type | Field and Description | 
|---|---|
protected SessionManager | 
_manager  | 
protected java.util.Map<java.lang.String,java.lang.Object> | 
_values  | 
| Constructor and Description | 
|---|
SessionImpl(SessionManager manager,
           java.lang.String id,
           long creationTime)
Create a new session object. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected java.util.Map<java.lang.String,java.lang.Object> | 
createValueMap()
Create the map used to objectStore values. 
 | 
void | 
finishRequest()
Cleaning up session stuff at the end of a request. 
 | 
java.lang.Object | 
getAttribute(java.lang.String name)
Returns the named attribute from the session. 
 | 
java.util.Enumeration | 
getAttributeNames()
Return an enumeration of all the sessions' attribute names. 
 | 
long | 
getCreationTime()
Returns the time the session was created. 
 | 
java.lang.String | 
getId()
Returns the session identifier. 
 | 
long | 
getLastAccessedTime()
Returns the last objectAccess time. 
 | 
int | 
getLastSaveLength()  | 
SessionManager | 
getManager()
Returns the session manager. 
 | 
int | 
getMaxInactiveInterval()
Returns the time the session is allowed to be alive. 
 | 
ServletContext | 
getServletContext()
Returns the servlet context. 
 | 
HttpSessionContext | 
getSessionContext()
Deprecated.   
 | 
protected int | 
getUseCount()  | 
java.lang.Object | 
getValue(java.lang.String name)
Deprecated.   
 | 
java.lang.String[] | 
getValueNames()
Deprecated.   
 | 
void | 
invalidate()
Invalidates the session, called by user code. 
 | 
void | 
invalidateLogout()
Invalidates a session based on a logout. 
 | 
void | 
invalidateRemote()
Invalidates the session, called by user code. 
 | 
boolean | 
isEmpty()
Returns true if the session is empty. 
 | 
boolean | 
isInUse()
Returns true if the session is in use. 
 | 
boolean | 
isNew()
Returns true if the session is new. 
 | 
boolean | 
isTimeout()  | 
boolean | 
isValid()
Returns true if the session is valid. 
 | 
boolean | 
load(boolean isNew)
Loads the session. 
 | 
boolean | 
load(SessionDeserializer in)
Loads the object from the input stream. 
 | 
void | 
passivate()
Passivates the session. 
 | 
void | 
putValue(java.lang.String name,
        java.lang.Object value)
Deprecated.   
 | 
void | 
removeAttribute(java.lang.String name)
Remove a session attribute. 
 | 
void | 
removeEvent()
Callback when the session is removed from the session cache, generally
 because the session cache is full. 
 | 
void | 
removeValue(java.lang.String name)
Deprecated.   
 | 
void | 
save()
Saves changes to the session. 
 | 
void | 
saveAfterRequest()
Flush changes after a request completes. 
 | 
void | 
saveBeforeFlush()
Save changes before any flush. 
 | 
void | 
saveBeforeHeaders()
Flush changes before the headers. 
 | 
void | 
setAccessTime(long accessTime)  | 
void | 
setAttribute(java.lang.String name,
            java.lang.Object value)
Sets a session attribute. 
 | 
void | 
setMaxInactiveInterval(int value)
Sets the maximum time a session is allowed to be alive. 
 | 
void | 
store(SessionSerializer out)
Saves the object to the input stream. 
 | 
void | 
timeout()
Called by the session manager for a session timeout 
 | 
java.lang.String | 
toString()  | 
void | 
unbind()
Cleans up the session. 
 | 
protected SessionManager _manager
protected java.util.Map<java.lang.String,java.lang.Object> _values
public SessionImpl(SessionManager manager, java.lang.String id, long creationTime)
manager - the owning session manager.id - the session identifier.creationTime - the time in milliseconds when the session was created.protected java.util.Map<java.lang.String,java.lang.Object> createValueMap()
public long getCreationTime()
getCreationTime in interface HttpSessionpublic java.lang.String getId()
getId in interface HttpSessionpublic long getLastAccessedTime()
getLastAccessedTime in interface HttpSessionpublic int getMaxInactiveInterval()
getMaxInactiveInterval in interface HttpSessionpublic void setMaxInactiveInterval(int value)
setMaxInactiveInterval in interface HttpSessionvalue - time allowed to live in secondspublic HttpSessionContext getSessionContext()
getSessionContext in interface HttpSessionpublic ServletContext getServletContext()
getServletContext in interface HttpSessionpublic SessionManager getManager()
public boolean isNew()
isNew in interface HttpSessionpublic boolean isValid()
public boolean isTimeout()
public boolean isEmpty()
public boolean isInUse()
protected int getUseCount()
public java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface HttpSessionname - of the attribute.public void setAttribute(java.lang.String name,
                         java.lang.Object value)
setAttribute in interface HttpSessionname - the name of the attributevalue - the value of the attributepublic void removeAttribute(java.lang.String name)
removeAttribute in interface HttpSessionname - the name of the attribute to objectRemovepublic java.util.Enumeration getAttributeNames()
getAttributeNames in interface HttpSessionpublic java.lang.Object getValue(java.lang.String name)
getValue in interface HttpSessionpublic void putValue(java.lang.String name,
                     java.lang.Object value)
putValue in interface HttpSessionpublic void removeValue(java.lang.String name)
removeValue in interface HttpSessionpublic java.lang.String[] getValueNames()
getValueNames in interface HttpSessionpublic void setAccessTime(long accessTime)
public int getLastSaveLength()
public void finishRequest()
If the session data has changed and we have persistent sessions, save the session. However, if save-on-shutdown is true, only save on a server shutdown.
public boolean load(boolean isNew)
public boolean load(SessionDeserializer in) throws java.io.IOException
java.io.IOExceptionpublic final void saveBeforeFlush()
public final void saveBeforeHeaders()
public final void saveAfterRequest()
public final void save()
public void passivate()
public void store(SessionSerializer out) throws java.io.IOException
java.io.IOExceptionpublic void invalidate()
invalidate in interface HttpSessionpublic void timeout()
public void removeEvent()
removeEvent in interface CacheListenerpublic void invalidateLogout()
public void invalidateRemote()
public void unbind()
public java.lang.String toString()
toString in class java.lang.Object