jrun.servlet.session
Class JRunSession

jrun.servlet.session.JRunSession
All Implemented Interfaces:
java.io.Serializable

public final class JRunSession
implements java.io.Serializable

See Also:
Serialized Form

Constructor Summary
JRunSession(Session context, java.lang.String id, SessionHolder holder)
          create a new session
 
Method Summary
 void clearAttributeSet()
           
protected  void fireAttributeAdded(jrun.servlet.session.HttpSessionBindingEvent event)
           
protected  void fireAttributeRemoved(jrun.servlet.session.HttpSessionBindingEvent event)
           
protected  void fireAttributeReplaced(jrun.servlet.session.HttpSessionBindingEvent event)
           
 java.lang.Object getAttribute(java.lang.String name)
          Returns the object bound to the given name in the session's application layer data.
 java.util.Enumeration getAttributeNames()
          return enumeration of application data bound to this session.
 long getCreationTime()
          Returns the time at which this Session representation was created, in milliseconds since the epoch.
protected  SessionHolder getHolder()
           
 java.lang.String getId()
          Returns the identifier assigned to this Session.
 long getLastAccessedTime()
          Returns the last time this Session representation was accessed by the session level infrastructure, in milliseconds since the epoch.
 int getMaxInactiveInterval()
          returns the max time interval (in seconds) this session can be active before it gets invalidated automatically.
 javax.servlet.ServletContext getServletContext()
           
 jrun.servlet.session.HttpSessionContext getSessionContext()
          Deprecated.  
 java.lang.Object getValue(java.lang.String name)
          Deprecated.  
 java.lang.String[] getValueNames()
          Deprecated. in favor of getAttributeNames()
 void invalidate()
          Indicates that this member is leaving the session, causing this representation of the Session to be invalidated and removed from its context.
 boolean isAttributeSet()
           
 boolean isNew()
           
 boolean isSessionValid()
          Returns true if this session is still valid (i.e.
 void putValue(java.lang.String name, java.lang.Object value)
           
 void removeAttribute(java.lang.String name)
          Removes the object bound to the given name in the session's application layer data.
 void removeValue(java.lang.String name)
           
 void setAttribute(java.lang.String name, java.lang.Object value)
          Binds the specified object into the session's application layer data with the given name.
protected  void setContext(Session context)
          set the session context handle that this session is associated with.
protected  void setHolder(SessionHolder holder)
           
 void setMaxInactiveInterval(int interval)
          set the max time interval this session can be active before it gets invalidated automatically.
 java.lang.String toString()
           
protected  void unbindAll()
          Unbind all objects.
protected  void updateLastAccessTime()
          Updates the last access time for this session.
 

Constructor Detail

JRunSession

public JRunSession(Session context,
                   java.lang.String id,
                   SessionHolder holder)
create a new session
Method Detail

setContext

protected void setContext(Session context)
set the session context handle that this session is associated with. Sessions can be serialized, so this handle can be reset when the session is read back in.

setHolder

protected void setHolder(SessionHolder holder)

getHolder

protected SessionHolder getHolder()

getCreationTime

public long getCreationTime()
                     throws java.lang.IllegalStateException
Returns the time at which this Session representation was created, in milliseconds since the epoch.

getMaxInactiveInterval

public int getMaxInactiveInterval()
returns the max time interval (in seconds) this session can be active before it gets invalidated automatically.

setMaxInactiveInterval

public void setMaxInactiveInterval(int interval)
set the max time interval this session can be active before it gets invalidated automatically.
Parameters:
interval - number of inactive seconds before invalidation

getId

public java.lang.String getId()
Returns the identifier assigned to this Session. Different kinds of session use different IDs, such as byte arrays, strings and multicast network addresses.

getLastAccessedTime

public long getLastAccessedTime()
                         throws java.lang.IllegalStateException
Returns the last time this Session representation was accessed by the session level infrastructure, in milliseconds since the epoch. Access indicates a session protocol level access to the session, such as a new member joining, an existing member leaving, a "keepalive" being sent, or a new connection being established using session data. Application level operations, such as getting or setting a value associated with the session, are not reflected in this access time.

getSessionContext

public jrun.servlet.session.HttpSessionContext getSessionContext()
Deprecated.  

Returns the context in which this session is bound. This context may be unavailable in some environments, in which case this method returns null.

getValue

public java.lang.Object getValue(java.lang.String name)
                          throws java.lang.IllegalStateException
Deprecated.  


getAttribute

public java.lang.Object getAttribute(java.lang.String name)
                              throws java.lang.IllegalStateException
Returns the object bound to the given name in the session's application layer data. Returns null if there is no such binding.
Parameters:
name - the name of the binding to find.

getValueNames

public java.lang.String[] getValueNames()
                                 throws java.lang.IllegalStateException
Deprecated. in favor of getAttributeNames()

Returns an array of the names of all the application layer data objects bound into the Session.

getAttributeNames

public java.util.Enumeration getAttributeNames()
                                        throws java.lang.IllegalStateException
return enumeration of application data bound to this session.

invalidate

public void invalidate()
                throws java.lang.IllegalStateException
Indicates that this member is leaving the session, causing this representation of the Session to be invalidated and removed from its context. The session itself may still continue to exist, if other members of the session wish to continue to participate. For example, one person leaving a session with three members will not necessarily cause the session itself to go away, since two members will usually be sufficient to keep a session alive.

isNew

public boolean isNew()
              throws java.lang.IllegalStateException

isAttributeSet

public boolean isAttributeSet()

clearAttributeSet

public void clearAttributeSet()

putValue

public void putValue(java.lang.String name,
                     java.lang.Object value)
              throws java.lang.IllegalStateException

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
                  throws java.lang.IllegalStateException
Binds the specified object into the session's application layer data with the given name. Any existing binding with the same name is replaced. If the new (or existing) value implements the JRunSessionBindingListener interface, it is notified appropriately.
Parameters:
name - the name to which the data object will be bound. This may not be null.
vlaue - the data object to be bound. This may not be null.

removeValue

public void removeValue(java.lang.String name)
                 throws java.lang.IllegalStateException

removeAttribute

public void removeAttribute(java.lang.String name)
                     throws java.lang.IllegalStateException
Removes the object bound to the given name in the session's application layer data. Does nothing if there is no object bound to the given name. If the value implements the SessionBindingListener interface, it is notified appropriately.

unbindAll

protected void unbindAll()
Unbind all objects. normally done when the session is invalidated or serialized out.

updateLastAccessTime

protected void updateLastAccessTime()
Updates the last access time for this session.

isSessionValid

public boolean isSessionValid()
Returns true if this session is still valid (i.e. has not be invalidated)

getServletContext

public javax.servlet.ServletContext getServletContext()

fireAttributeAdded

protected void fireAttributeAdded(jrun.servlet.session.HttpSessionBindingEvent event)

fireAttributeRemoved

protected void fireAttributeRemoved(jrun.servlet.session.HttpSessionBindingEvent event)

fireAttributeReplaced

protected void fireAttributeReplaced(jrun.servlet.session.HttpSessionBindingEvent event)

toString

public java.lang.String toString()


Copyright � 2002 Macromedia Corporation. All Rights Reserved.