| java.lang.Object org.apache.catalina.session.StandardSession
StandardSession | class StandardSession implements HttpSession,Session,Serializable(Code) | | Standard implementation of the Session interface. This object is
serializable, so that it can be stored in persistent storage or transferred
to a different JVM for distributable session support.
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.
author: Craig R. McClanahan author: Sean Legassick author: Jon S. Stevens version: $Revision: 1.31 $ $Date: 2002/07/23 12:49:11 $ |
Constructor Summary | |
public | StandardSession(Manager manager) Construct a new Session associated with the specified Manager. |
Method Summary | |
public void | access() Update the accessed time information for this session. | public void | activate() Perform internal processing required to activate this
session. | public void | addSessionListener(SessionListener listener) Add a session event listener to this component. | 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 | fireSessionEvent(String type, Object data) Notify all session event listeners that a particular event has
occurred for this Session. | 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. | 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 String | getId() 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. | 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. | 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. | 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() Return the session context with which this session is associated. | public Object | getValue(String name) Return the object bound with the specified name in this session, or
null if no object is bound with that name. | public String[] | getValueNames() Return the set of names of objects bound to this session. | 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. | public boolean | isValid() Return the isValid flag for this session. | public void | passivate() Perform the internal processing required to passivate
this session. | public void | putValue(String name, Object value) Bind an object to this session, using the specified name. | void | readObjectData(ObjectInputStream stream) 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. | public void | removeAttribute(String name, boolean notify) Remove the object bound with the specified name from this session. | 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) Remove the object bound with the specified name from this session. | public void | setAttribute(String name, Object value) Bind an object to this session, using the specified name. | 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. | public void | setId(String id) Set the session identifier for this session. | 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. | public void | setNew(boolean isNew) Set the isNew flag for this session. | 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 | setPrincipal(Principal principal) Set the authenticated Principal that is associated with this Session. | public void | setValid(boolean isValid) Set the isValid flag for this session. | public String | toString() Return a string representation of this object. | void | writeObjectData(ObjectOutputStream stream) 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. |
StandardSession | public StandardSession(Manager manager)(Code) | | Construct a new Session associated with the specified Manager.
Parameters: manager - The manager with which this Session is associated |
access | public void access()(Code) | | 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.
|
activate | public void activate()(Code) | | Perform internal processing required to activate this
session.
|
addSessionListener | public void addSessionListener(SessionListener listener)(Code) | | Add a session event listener to this component.
|
expire | public void expire()(Code) | | Perform the internal processing required to invalidate this session,
without triggering an exception if the session has already expired.
|
expire | public void expire(boolean notify)(Code) | | Perform the internal processing required to invalidate this session,
without triggering an exception if the session has already expired.
Parameters: notify - Should we notify listeners about the demise ofthis session? |
fireSessionEvent | public void fireSessionEvent(String type, Object data)(Code) | | 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.
Parameters: type - Event type Parameters: data - Event data |
getAttribute | public Object getAttribute(String name)(Code) | | Return the object bound with the specified name in this session, or
null if no object is bound with that name.
Parameters: name - Name of the attribute to be returned exception: IllegalStateException - if this method is called on aninvalidated session |
getAttributeNames | public Enumeration getAttributeNames()(Code) | | Return an Enumeration of String objects
containing the names of the objects bound to this session.
exception: IllegalStateException - if this method is called on aninvalidated session |
getAuthType | public String getAuthType()(Code) | | Return the authentication type used to authenticate our cached
Principal, if any.
|
getCreationTime | public long getCreationTime()(Code) | | Return the time when this session was created, in milliseconds since
midnight, January 1, 1970 GMT.
exception: IllegalStateException - if this method is called on aninvalidated session |
getId | public String getId()(Code) | | Return the session identifier for this session.
|
getInfo | public String getInfo()(Code) | | Return descriptive information about this Session implementation and
the corresponding version number, in the format
<description>/<version> .
|
getLastAccessedTime | public long getLastAccessedTime()(Code) | | 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.
|
getManager | public Manager getManager()(Code) | | Return the Manager within which this Session is valid.
|
getMaxInactiveInterval | public int getMaxInactiveInterval()(Code) | | 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.
|
getNote | public Object getNote(String name)(Code) | | Return the object bound with the specified name to the internal notes
for this session, or null if no such binding exists.
Parameters: name - Name of the note to be returned |
getNoteNames | public Iterator getNoteNames()(Code) | | Return an Iterator containing the String names of all notes bindings
that exist for this session.
|
getPrincipal | public Principal getPrincipal()(Code) | | 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 .
|
getServletContext | public ServletContext getServletContext()(Code) | | Return the ServletContext to which this session belongs.
|
getSession | public HttpSession getSession()(Code) | | Return the HttpSession for which this object
is the facade.
|
getSessionContext | public HttpSessionContext getSessionContext()(Code) | | Return the session context with which this session is associated.
|
getValue | public Object getValue(String name)(Code) | | Return the object bound with the specified name in this session, or
null if no object is bound with that name.
Parameters: name - Name of the value to be returned exception: IllegalStateException - if this method is called on aninvalidated session |
getValueNames | public String[] getValueNames()(Code) | | Return the set of names of objects bound to this session. If there
are no such objects, a zero-length array is returned.
exception: IllegalStateException - if this method is called on aninvalidated session |
invalidate | public void invalidate()(Code) | | Invalidates this session and unbinds any objects bound to it.
exception: IllegalStateException - if this method is called onan invalidated session |
isNew | public boolean isNew()(Code) | | 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.
exception: IllegalStateException - if this method is called on aninvalidated session |
isValid | public boolean isValid()(Code) | | Return the isValid flag for this session.
|
passivate | public void passivate()(Code) | | Perform the internal processing required to passivate
this session.
|
putValue | public void putValue(String name, Object value)(Code) | | 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.
Parameters: name - Name to which the object is bound, cannot be null Parameters: value - Object to be bound, cannot be null exception: IllegalStateException - if this method is called on aninvalidated session |
readObjectData | void readObjectData(ObjectInputStream stream) throws ClassNotFoundException, IOException(Code) | | 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.
Parameters: stream - The object input stream to read from exception: ClassNotFoundException - if an unknown class is specified exception: IOException - if an input/output error occurs |
recycle | public void recycle()(Code) | | Release all object references, and initialize instance variables, in
preparation for reuse of this object.
|
removeAttribute | public void removeAttribute(String name)(Code) | | 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.
Parameters: name - Name of the object to remove from this session. exception: IllegalStateException - if this method is called on aninvalidated session |
removeAttribute | public void removeAttribute(String name, boolean notify)(Code) | | 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.
Parameters: name - Name of the object to remove from this session. Parameters: notify - Should we notify interested listeners that thisattribute is being removed? exception: IllegalStateException - if this method is called on aninvalidated session |
removeNote | public void removeNote(String name)(Code) | | Remove any object bound to the specified name in the internal notes
for this session.
Parameters: name - Name of the note to be removed |
removeSessionListener | public void removeSessionListener(SessionListener listener)(Code) | | Remove a session event listener from this component.
|
removeValue | public void removeValue(String name)(Code) | | 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.
Parameters: name - Name of the object to remove from this session. exception: IllegalStateException - if this method is called on aninvalidated session |
setAttribute | public void setAttribute(String name, Object value)(Code) | | 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.
Parameters: name - Name to which the object is bound, cannot be null Parameters: value - Object to be bound, cannot be null exception: IllegalArgumentException - if an attempt is made to add anon-serializable object in an environment marked distributable. exception: IllegalStateException - if this method is called on aninvalidated session |
setAuthType | public void setAuthType(String authType)(Code) | | Set the authentication type used to authenticate our cached
Principal, if any.
Parameters: authType - The new cached authentication type |
setCreationTime | public void setCreationTime(long time)(Code) | | Set the creation time for this session. This method is called by the
Manager when an existing Session instance is reused.
Parameters: time - The new creation time |
setId | public void setId(String id)(Code) | | Set the session identifier for this session.
Parameters: id - The new session identifier |
setManager | public void setManager(Manager manager)(Code) | | Set the Manager within which this Session is valid.
Parameters: manager - The new Manager |
setMaxInactiveInterval | public void setMaxInactiveInterval(int interval)(Code) | | 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.
Parameters: interval - The new maximum interval |
setNew | public void setNew(boolean isNew)(Code) | | Set the isNew flag for this session.
Parameters: isNew - The new value for the isNew flag |
setNote | public void setNote(String name, Object value)(Code) | | Bind an object to a specified name in the internal notes associated
with this session, replacing any existing binding for this name.
Parameters: name - Name to which the object should be bound Parameters: value - Object to be bound to the specified name |
setPrincipal | public void setPrincipal(Principal principal)(Code) | | 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.
Parameters: principal - The new Principal, or null if none |
setValid | public void setValid(boolean isValid)(Code) | | Set the isValid flag for this session.
Parameters: isValid - The new value for the isValid flag |
toString | public String toString()(Code) | | Return a string representation of this object.
|
writeObjectData | void writeObjectData(ObjectOutputStream stream) throws IOException(Code) | | 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.
Parameters: stream - The object output stream to write to exception: IOException - if an input/output error occurs |
|
|