org.apache.tomcat.core
Class ServerSession

java.lang.Object
  extended byorg.apache.tomcat.core.ServerSession

public class ServerSession
extends java.lang.Object

Server representation of a Session. - recyclable - serializable ( by external components ) Components: - timestamp ( expire ) - id - name/value repository

Author:
Craig R. McClanahan, Jon S. Stevens, Costin Manolache

Field Summary
static int STATE_ACCESSED
          The session was accessed.
static int STATE_EXPIRED
          If you set the server session object in the EXPIRED state, it'll do all the cleanup and be removed from the active sessions.
static int STATE_INVALID
           
static int STATE_NEW
          Session is new.
static int STATE_RESTORED
          After restart - or after reload
static int STATE_SUSPEND
          The session will be prepared for suspending - same as for reload.
 
Constructor Summary
ServerSession()
           
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
           
 int getAttributeCount()
           
 java.util.Enumeration getAttributeNames()
           
 Context getContext()
          The web application that creates this session.
 java.lang.Object getFacade()
           
 MessageBytes getId()
          Return the session identifier for this session.
 java.lang.Object getManager()
           
 java.lang.Object getNote(int pos)
           
 java.lang.Object getNote(java.lang.String name)
           
 int getState()
           
 TimeStamp getTimeStamp()
          The time stamp associated with this session
 boolean isValid()
           
 void recycle()
          Release all object references, and initialize instance variables, in preparation for reuse of this object.
 void removeAllAttributes()
           
 void removeAttribute(java.lang.String name)
           
 void setAttribute(java.lang.String name, java.lang.Object value)
           
 void setContext(Context ctx)
           
 void setContextManager(ContextManager cm)
           
 void setDebug(int d)
          Display debug messages.
 void setFacade(java.lang.Object o)
           
 void setManager(java.lang.Object m)
          The object that controls this server session.
 void setNote(int pos, java.lang.Object value)
           
 void setNote(java.lang.String name, java.lang.Object value)
           
 void setState(int state)
          Change the state, call all hooks
 void setState(int state, Request req)
          Change the state, call all hooks.
protected  void setState1(int state)
           
 void setValid(boolean b)
           
 void touch(long time)
          Set the session access time
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_NEW

public static final int STATE_NEW
Session is new. Modules can do all the preparation work - set id, register it for expiration, etc

See Also:
Constant Field Values

STATE_ACCESSED

public static final int STATE_ACCESSED
The session was accessed. Nothing big.

See Also:
Constant Field Values

STATE_EXPIRED

public static final int STATE_EXPIRED
If you set the server session object in the EXPIRED state, it'll do all the cleanup and be removed from the active sessions. You must make sure you recycle the object after setState(STATE_EXPIRED)

See Also:
Constant Field Values

STATE_INVALID

public static final int STATE_INVALID
See Also:
Constant Field Values

STATE_SUSPEND

public static final int STATE_SUSPEND
The session will be prepared for suspending - same as for reload. What can be preserved will be, or unbind events will be generated.

See Also:
Constant Field Values

STATE_RESTORED

public static final int STATE_RESTORED
After restart - or after reload

See Also:
Constant Field Values
Constructor Detail

ServerSession

public ServerSession()
Method Detail

setManager

public void setManager(java.lang.Object m)
The object that controls this server session. We don't care about the implementation details of the manager, but store a reference.


getManager

public java.lang.Object getManager()

getContext

public Context getContext()
The web application that creates this session. Don't relly on this, as we may have cross-context sessions in a future version. Used to get the session options, represents the webapp that creates the session.


setContext

public void setContext(Context ctx)

setContextManager

public void setContextManager(ContextManager cm)

getFacade

public java.lang.Object getFacade()

setFacade

public void setFacade(java.lang.Object o)

getState

public final int getState()

setState

public void setState(int state)
Change the state, call all hooks


setState1

protected void setState1(int state)

setState

public void setState(int state,
                     Request req)
Change the state, call all hooks. The request that initiated the event is passed


getTimeStamp

public TimeStamp getTimeStamp()
The time stamp associated with this session


getId

public MessageBytes getId()
Return the session identifier for this session.


getAttribute

public java.lang.Object getAttribute(java.lang.String name)

getAttributeNames

public java.util.Enumeration getAttributeNames()

getAttributeCount

public int getAttributeCount()

removeAllAttributes

public void removeAllAttributes()

removeAttribute

public void removeAttribute(java.lang.String name)

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)

touch

public void touch(long time)
Set the session access time


setValid

public void setValid(boolean b)

isValid

public boolean isValid()

setDebug

public void setDebug(int d)
Display debug messages. Set by the session creator - typically the session store ( SimpleSessionStore in 3.3 ).


recycle

public void recycle()
Release all object references, and initialize instance variables, in preparation for reuse of this object.


setNote

public final void setNote(int pos,
                          java.lang.Object value)

getNote

public final java.lang.Object getNote(int pos)

getNote

public java.lang.Object getNote(java.lang.String name)
                         throws TomcatException
Throws:
TomcatException

setNote

public void setNote(java.lang.String name,
                    java.lang.Object value)
             throws TomcatException
Throws:
TomcatException


Copyright © 2001 Apache Software Foundation. All Rights Reserved.