Home » apache-tomcat-6.0.26-src » org.apache » catalina » cluster » session » [javadoc | source]
org.apache.catalina.cluster.session
public class: DeltaSession [javadoc | source]
java.lang.Object
   org.apache.catalina.cluster.session.DeltaSession

All Implemented Interfaces:
    HttpSession, Session, ClusterSession, Serializable

Direct Known Subclasses:
    MockSession

Similar to the StandardSession, this code is identical, but for update and some small issues, simply copied in the first release. This session will keep track of deltas during a request.

IMPLEMENTATION NOTE : An instance of this class represents both the internal (Session) and application level (HttpSession) view of the session. However, because the class itself is not declared public, Java logic outside of the org.apache.catalina.session package cannot cast an HttpSession view of this instance back to a Session view.

IMPLEMENTATION NOTE : If you add fields to this class, you must make sure that you carry them over in the read/writeObject methods so that this class is properly serialized.

Field Summary
public static  Log log     
protected static  StringManager smp    The string manager for this package. 
protected static final  String[] EMPTY_ARRAY    Type array. 
protected  boolean isValid    Flag indicating whether this session is valid or not. 
protected transient  int accessCount    The access count for this session 
Constructor:
 public DeltaSession(Manager manager) 
    Construct a new Session associated with the specified Manager.
    Parameters:
    manager - The manager with which this Session is associated
Method from org.apache.catalina.cluster.session.DeltaSession Summary:
access,   addSessionListener,   endAccess,   expire,   expire,   expire,   fireSessionEvent,   getAccessCount,   getAttribute,   getAttributeInternal,   getAttributeNames,   getAuthType,   getCreationTime,   getDeltaRequest,   getId,   getIdInternal,   getInfo,   getLastAccessedTime,   getLastTimeReplicated,   getManager,   getMaxInactiveInterval,   getNote,   getNoteNames,   getPrincipal,   getServletContext,   getSession,   getSessionContext,   getValue,   getValueNames,   invalidate,   isNew,   isPrimarySession,   isValid,   keys,   putValue,   readObjectData,   recycle,   removeAttribute,   removeAttribute,   removeAttribute,   removeAttributeInternal,   removeNote,   removeSessionListener,   removeValue,   resetDeltaRequest,   setAccessCount,   setAttribute,   setAttribute,   setAuthType,   setCreationTime,   setId,   setIdInternal,   setLastTimeReplicated,   setManager,   setMaxInactiveInterval,   setMaxInactiveInterval,   setNew,   setNew,   setNote,   setPrimarySession,   setPrincipal,   setPrincipal,   setValid,   tellNew,   toString,   writeObjectData
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.catalina.cluster.session.DeltaSession Detail:
 public  void access() 
    Update the accessed time information for this session. This method should be called by the context when a request comes in for a particular session, even if the application does not reference it.
 public  void addSessionListener(SessionListener listener) 
    Add a session event listener to this component.
 public  void endAccess() 
 public  void expire() 
    Perform the internal processing required to invalidate this session, without triggering an exception if the session has already expired.
 public  void expire(boolean notify) 
    Perform the internal processing required to invalidate this session, without triggering an exception if the session has already expired.
 public  void expire(boolean notify,
    boolean notifyCluster) 
 public  void fireSessionEvent(String type,
    Object data) 
    Notify all session event listeners that a particular event has occurred for this Session. The default implementation performs this notification synchronously using the calling thread.
 protected int getAccessCount() 
 public Object getAttribute(String name) 
    Return the object bound with the specified name in this session, or null if no object is bound with that name.
 protected Object getAttributeInternal(String name) 
    Return the value of an attribute without a check for validity.
 public Enumeration getAttributeNames() 
    Return an Enumeration of String objects containing the names of the objects bound to this session.
 public String getAuthType() 
    Return the authentication type used to authenticate our cached Principal, if any.
 public long getCreationTime() 
    Return the time when this session was created, in milliseconds since midnight, January 1, 1970 GMT.
 public DeltaRequest getDeltaRequest() 
 public String getId() 
    Return the session identifier for this session.
 public String getIdInternal() 
    Return the session identifier for this session.
 public String getInfo() 
    Return descriptive information about this Session implementation and the corresponding version number, in the format <description>/<version>.
 public long getLastAccessedTime() 
    Return the last time the client sent a request associated with this session, as the number of milliseconds since midnight, January 1, 1970 GMT. Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.
 protected long getLastTimeReplicated() 
 public Manager getManager() 
    Return the Manager within which this Session is valid.
 public int getMaxInactiveInterval() 
    Return the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session. A negative time indicates that the session should never time out.
 public Object getNote(String name) 
    Return the object bound with the specified name to the internal notes for this session, or null if no such binding exists.
 public Iterator getNoteNames() 
    Return an Iterator containing the String names of all notes bindings that exist for this session.
 public Principal getPrincipal() 
    Return the authenticated Principal that is associated with this Session. This provides an Authenticator with a means to cache a previously authenticated Principal, and avoid potentially expensive Realm.authenticate() calls on every request. If there is no current associated Principal, return null.
 public ServletContext getServletContext() 
    Return the ServletContext to which this session belongs.
 public HttpSession getSession() 
    Return the HttpSession for which this object is the facade.
 public HttpSessionContext getSessionContext() 
Deprecated! As - of Version 2.1, this method is deprecated and has no replacement. It will be removed in a future version of the Java Servlet API.

    Return the session context with which this session is associated.
 public Object getValue(String name) 
Deprecated! As - of Version 2.2, this method is replaced by getAttribute()

    Return the object bound with the specified name in this session, or null if no object is bound with that name.
 public String[] getValueNames() 
Deprecated! As - of Version 2.2, this method is replaced by getAttributeNames()

    Return the set of names of objects bound to this session. If there are no such objects, a zero-length array is returned.
 public  void invalidate() 
    Invalidates this session and unbinds any objects bound to it.
 public boolean isNew() 
    Return true if the client does not yet know about the session, or if the client chooses not to join the session. For example, if the server used only cookie-based sessions, and the client has disabled the use of cookies, then a session would be new on each request.
 public boolean isPrimarySession() 
    returns true if this session is the primary session, if that is the case, the manager can expire it upon timeout.
 public boolean isValid() 
    Return the isValid flag for this session.
 protected String[] keys() 
    Return the names of all currently defined session attributes as an array of Strings. If there are no defined attributes, a zero-length array is returned.
 public  void putValue(String name,
    Object value) 
Deprecated! As - of Version 2.2, this method is replaced by setAttribute()

    Bind an object to this session, using the specified name. If an object of the same name is already bound to this session, the object is replaced.

    After this method executes, and if the object implements HttpSessionBindingListener, the container calls valueBound() on the object.

 public  void readObjectData(ObjectInputStream stream) throws ClassNotFoundException, IOException 
    Read a serialized version of the contents of this session object from the specified object input stream, without requiring that the StandardSession itself have been serialized.
 public  void recycle() 
    Release all object references, and initialize instance variables, in preparation for reuse of this object.
 public  void removeAttribute(String name) 
    Remove the object bound with the specified name from this session. If the session does not have an object bound with this name, this method does nothing.

    After this method executes, and if the object implements HttpSessionBindingListener, the container calls valueUnbound() on the object.

 public  void removeAttribute(String name,
    boolean notify) 
    Remove the object bound with the specified name from this session. If the session does not have an object bound with this name, this method does nothing.

    After this method executes, and if the object implements HttpSessionBindingListener, the container calls valueUnbound() on the object.

 public  void removeAttribute(String name,
    boolean notify,
    boolean addDeltaRequest) 
 protected  void removeAttributeInternal(String name,
    boolean notify,
    boolean addDeltaRequest) 
 public  void removeNote(String name) 
    Remove any object bound to the specified name in the internal notes for this session.
 public  void removeSessionListener(SessionListener listener) 
    Remove a session event listener from this component.
 public  void removeValue(String name) 
Deprecated! As - of Version 2.2, this method is replaced by removeAttribute()

    Remove the object bound with the specified name from this session. If the session does not have an object bound with this name, this method does nothing.

    After this method executes, and if the object implements HttpSessionBindingListener, the container calls valueUnbound() on the object.

 public  void resetDeltaRequest() 
 protected  void setAccessCount(int accessCount) 
 public  void setAttribute(String name,
    Object value) 
    Bind an object to this session, using the specified name. If an object of the same name is already bound to this session, the object is replaced.

    After this method executes, and if the object implements HttpSessionBindingListener, the container calls valueBound() on the object.

 public  void setAttribute(String name,
    Object value,
    boolean notify,
    boolean addDeltaRequest) 
 public  void setAuthType(String authType) 
    Set the authentication type used to authenticate our cached Principal, if any.
 public  void setCreationTime(long time) 
    Set the creation time for this session. This method is called by the Manager when an existing Session instance is reused.
 public  void setId(String id) 
    Set the session identifier for this session.
 public  void setIdInternal(String id) 
    Set the session identifier for this session without notify listeners.
 protected  void setLastTimeReplicated(long lastTimeReplicated) 
 public  void setManager(Manager manager) 
    Set the Manager within which this Session is valid.
 public  void setMaxInactiveInterval(int interval) 
    Set the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session. A negative time indicates that the session should never time out.
 public  void setMaxInactiveInterval(int interval,
    boolean addDeltaRequest) 
 public  void setNew(boolean isNew) 
    Set the isNew flag for this session.
 public  void setNew(boolean isNew,
    boolean addDeltaRequest) 
 public  void setNote(String name,
    Object value) 
    Bind an object to a specified name in the internal notes associated with this session, replacing any existing binding for this name.
 public  void setPrimarySession(boolean primarySession) 
    Sets whether this is the primary session or not.
 public  void setPrincipal(Principal principal) 
    Set the authenticated Principal that is associated with this Session. This provides an Authenticator with a means to cache a previously authenticated Principal, and avoid potentially expensive Realm.authenticate() calls on every request.
 public  void setPrincipal(Principal principal,
    boolean addDeltaRequest) 
 public  void setValid(boolean isValid) 
    Set the isValid flag for this session.
 public  void tellNew() 
    Inform the listeners about the new session.
 public String toString() 
    Return a string representation of this object.
 public  void writeObjectData(ObjectOutputStream stream) throws IOException 
    Write a serialized version of the contents of this session object to the specified object output stream, without requiring that the StandardSession itself have been serialized.