Class StandardSession
- java.lang.Object
-
- org.apache.catalina.session.StandardSession
-
- All Implemented Interfaces:
HttpSession,java.io.Serializable,Session
- Direct Known Subclasses:
DeltaSession
public class StandardSession extends java.lang.Object implements HttpSession, Session, java.io.Serializable
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: 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.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.atomic.AtomicIntegeraccessCountThe access count for this session.protected booleanactivityCheckThe activity check for this session.protected java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.Object>attributesThe collection of user data attributes associated with this Session.protected java.lang.StringauthTypeThe authentication type used to authenticate our cached Principal, if any.protected longcreationTimeThe time this session was created, in milliseconds since midnight, January 1, 1970 GMT.protected static java.lang.String[]EMPTY_ARRAYType array.protected booleanexpiringWe are currently processing a session expiration, so bypass certain IllegalStateException tests.protected StandardSessionFacadefacadeThe facade associated with this session.protected java.lang.StringidThe session identifier of this Session.protected booleanisNewFlag indicating whether this session is new or not.protected booleanisValidFlag indicating whether this session is valid or not.protected booleanlastAccessAtStartThe behavior of the last access check.protected longlastAccessedTimeThe last accessed time for this Session.protected java.util.ArrayList<SessionListener>listenersThe session event listeners for this Session.protected ManagermanagerThe Manager with which this Session is associated.protected intmaxInactiveIntervalThe maximum time interval, in seconds, between client requests before the servlet container may invalidate this session.protected java.util.Map<java.lang.String,java.lang.Object>notesInternal notes associated with this session by Catalina components and event listeners.protected java.security.PrincipalprincipalThe authenticated Principal associated with this session, if any.protected static StringManagersmThe string manager for this package.protected java.beans.PropertyChangeSupportsupportThe property change support for this component.protected longthisAccessedTimeThe current accessed time for this session.-
Fields inherited from interface org.apache.catalina.Session
SESSION_ACTIVATED_EVENT, SESSION_CHANGED_ID_EVENT, SESSION_CREATED_EVENT, SESSION_DESTROYED_EVENT, SESSION_PASSIVATED_EVENT
-
-
Constructor Summary
Constructors Constructor Description StandardSession(Manager manager)Construct a new Session associated with the specified Manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccess()Update the accessed time information for this session.voidactivate()Perform internal processing required to activate this session.voidaddSessionListener(SessionListener listener)Add a session event listener to this component.protected voiddoReadObject(java.io.ObjectInputStream stream)Read a serialized version of this session object from the specified object input stream.protected voiddoWriteObject(java.io.ObjectOutputStream stream)Write a serialized version of this session object to the specified object output stream.voidendAccess()End access to the session.protected booleanexclude(java.lang.String name, java.lang.Object value)Should the given session attribute be excluded?voidexpire()Perform the internal processing required to invalidate this session, without triggering an exception if the session has already expired.voidexpire(boolean notify)Perform the internal processing required to invalidate this session, without triggering an exception if the session has already expired.voidfireSessionEvent(java.lang.String type, java.lang.Object data)Notify all session event listeners that a particular event has occurred for this Session.java.lang.ObjectgetAttribute(java.lang.String name)Returns the object bound with the specified name in this session, ornullif no object is bound under the name.java.util.Enumeration<java.lang.String>getAttributeNames()Returns anEnumerationofStringobjects containing the names of all the objects bound to this session.java.lang.StringgetAuthType()longgetCreationTime()Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.longgetCreationTimeInternal()java.lang.StringgetId()Returns a string containing the unique identifier assigned to this session.java.lang.StringgetIdInternal()longgetIdleTime()longgetIdleTimeInternal()longgetLastAccessedTime()Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT, and marked by the time the container received the request.longgetLastAccessedTimeInternal()ManagergetManager()intgetMaxInactiveInterval()Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses.java.lang.ObjectgetNote(java.lang.String name)java.util.Iterator<java.lang.String>getNoteNames()java.security.PrincipalgetPrincipal()ServletContextgetServletContext()Returns the ServletContext to which this session belongs.HttpSessiongetSession()longgetThisAccessedTime()longgetThisAccessedTimeInternal()voidinvalidate()Invalidates this session then unbinds any objects bound to it.booleanisAttributeDistributable(java.lang.String name, java.lang.Object value)Does the session implementation support the distributing of the given attribute?booleanisNew()Returnstrueif the client does not yet know about the session or if the client chooses not to join the session.booleanisValid()protected booleanisValidInternal()protected java.lang.String[]keys()voidpassivate()Perform the internal processing required to passivate this session.voidreadObjectData(java.io.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.voidrecycle()Release all object references, and initialize instance variables, in preparation for reuse of this object.voidremoveAttribute(java.lang.String name)Removes the object bound with the specified name from this session.voidremoveAttribute(java.lang.String name, boolean notify)Remove the object bound with the specified name from this session.protected voidremoveAttributeInternal(java.lang.String name, boolean notify)Remove the object bound with the specified name from this session.voidremoveNote(java.lang.String name)Remove any object bound to the specified name in the internal notes for this session.voidremoveSessionListener(SessionListener listener)Remove a session event listener from this component.voidsetAttribute(java.lang.String name, java.lang.Object value)Binds an object to this session, using the name specified.voidsetAttribute(java.lang.String name, java.lang.Object value, boolean notify)Bind an object to this session, using the specified name.voidsetAuthType(java.lang.String authType)Set the authentication type used to authenticate our cached Principal, if any.voidsetCreationTime(long time)Set the creation time for this session.voidsetId(java.lang.String id)Set the session identifier for this session and notifies any associated listeners that a new session has been created.voidsetId(java.lang.String id, boolean notify)Set the session identifier for this session and optionally notifies any associated listeners that a new session has been created.voidsetManager(Manager manager)Set the Manager within which this Session is valid.voidsetMaxInactiveInterval(int interval)Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.voidsetNew(boolean isNew)Set theisNewflag for this session.voidsetNote(java.lang.String name, java.lang.Object value)Bind an object to a specified name in the internal notes associated with this session, replacing any existing binding for this name.voidsetPrincipal(java.security.Principal principal)Set the authenticated Principal that is associated with this Session.voidsetValid(boolean isValid)Set theisValidflag for this session.voidtellChangedSessionId(java.lang.String newId, java.lang.String oldId, boolean notifySessionListeners, boolean notifyContainerListeners)Inform the listeners about the change session ID.voidtellNew()Inform the listeners about the new session.java.lang.StringtoString()voidwriteObjectData(java.io.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.
-
-
-
Field Detail
-
EMPTY_ARRAY
protected static final java.lang.String[] EMPTY_ARRAY
Type array.
-
attributes
protected java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.Object> attributes
The collection of user data attributes associated with this Session.
-
authType
protected transient java.lang.String authType
The authentication type used to authenticate our cached Principal, if any. NOTE: This value is not included in the serialized version of this object.
-
creationTime
protected long creationTime
The time this session was created, in milliseconds since midnight, January 1, 1970 GMT.
-
expiring
protected transient volatile boolean expiring
We are currently processing a session expiration, so bypass certain IllegalStateException tests. NOTE: This value is not included in the serialized version of this object.
-
facade
protected transient StandardSessionFacade facade
The facade associated with this session. NOTE: This value is not included in the serialized version of this object.
-
id
protected java.lang.String id
The session identifier of this Session.
-
lastAccessedTime
protected volatile long lastAccessedTime
The last accessed time for this Session.
-
listeners
protected transient java.util.ArrayList<SessionListener> listeners
The session event listeners for this Session.
-
manager
protected transient Manager manager
The Manager with which this Session is associated.
-
maxInactiveInterval
protected volatile int maxInactiveInterval
The maximum time interval, in seconds, between client requests before the servlet container may invalidate this session. A negative time indicates that the session should never time out.
-
isNew
protected volatile boolean isNew
Flag indicating whether this session is new or not.
-
isValid
protected volatile boolean isValid
Flag indicating whether this session is valid or not.
-
notes
protected transient java.util.Map<java.lang.String,java.lang.Object> notes
Internal notes associated with this session by Catalina components and event listeners. IMPLEMENTATION NOTE: This object is not saved and restored across session serializations!
-
principal
protected transient java.security.Principal principal
The authenticated Principal associated with this session, if any. IMPLEMENTATION NOTE: This object is not saved and restored across session serializations!
-
sm
protected static final StringManager sm
The string manager for this package.
-
support
protected final transient java.beans.PropertyChangeSupport support
The property change support for this component. NOTE: This value is not included in the serialized version of this object.
-
thisAccessedTime
protected volatile long thisAccessedTime
The current accessed time for this session.
-
accessCount
protected transient java.util.concurrent.atomic.AtomicInteger accessCount
The access count for this session.
-
activityCheck
protected transient boolean activityCheck
The activity check for this session.
-
lastAccessAtStart
protected transient boolean lastAccessAtStart
The behavior of the last access check.
-
-
Constructor Detail
-
StandardSession
public StandardSession(Manager manager)
Construct a new Session associated with the specified Manager.- Parameters:
manager- The manager with which this Session is associated
-
-
Method Detail
-
getAuthType
public java.lang.String getAuthType()
- Specified by:
getAuthTypein interfaceSession- Returns:
- the authentication type used to authenticate our cached Principal, if any.
-
setAuthType
public void setAuthType(java.lang.String authType)
Description copied from interface:SessionSet the authentication type used to authenticate our cached Principal, if any.- Specified by:
setAuthTypein interfaceSession- Parameters:
authType- The new cached authentication type
-
setCreationTime
public void setCreationTime(long time)
Description copied from interface:SessionSet the creation time for this session. This method is called by the Manager when an existing Session instance is reused.- Specified by:
setCreationTimein interfaceSession- Parameters:
time- The new creation time
-
getId
public java.lang.String getId()
Description copied from interface:jakarta.servlet.http.HttpSessionReturns a string containing the unique identifier assigned to this session. The identifier is assigned by the servlet container and is implementation dependent.- Specified by:
getIdin interfaceHttpSession- Specified by:
getIdin interfaceSession- Returns:
- a string specifying the identifier assigned to this session
-
getIdInternal
public java.lang.String getIdInternal()
- Specified by:
getIdInternalin interfaceSession- Returns:
- the session identifier for this session.
-
setId
public void setId(java.lang.String id)
Description copied from interface:SessionSet the session identifier for this session and notifies any associated listeners that a new session has been created.
-
setId
public void setId(java.lang.String id, boolean notify)Description copied from interface:SessionSet the session identifier for this session and optionally notifies any associated listeners that a new session has been created.
-
tellNew
public void tellNew()
Inform the listeners about the new session.
-
tellChangedSessionId
public void tellChangedSessionId(java.lang.String newId, java.lang.String oldId, boolean notifySessionListeners, boolean notifyContainerListeners)Description copied from interface:SessionInform the listeners about the change session ID.- Specified by:
tellChangedSessionIdin interfaceSession- Parameters:
newId- new session IDoldId- old session IDnotifySessionListeners- Should any associated sessionListeners be notified that session ID has been changed?notifyContainerListeners- Should any associated ContainerListeners be notified that session ID has been changed?
-
getThisAccessedTime
public long getThisAccessedTime()
- Specified by:
getThisAccessedTimein interfaceSession- Returns:
- 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. This one gets updated whenever a request starts.
-
getThisAccessedTimeInternal
public long getThisAccessedTimeInternal()
- Specified by:
getThisAccessedTimeInternalin interfaceSession- Returns:
- the last client access time without invalidation check
- See Also:
Session.getThisAccessedTime()
-
getLastAccessedTime
public long getLastAccessedTime()
Description copied from interface:jakarta.servlet.http.HttpSessionReturns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT, and marked by the time the container received the request.Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.
- Specified by:
getLastAccessedTimein interfaceHttpSession- Specified by:
getLastAccessedTimein interfaceSession- Returns:
- a
longrepresenting the last time the client sent a request associated with this session, expressed in milliseconds since 1/1/1970 GMT
-
getLastAccessedTimeInternal
public long getLastAccessedTimeInternal()
- Specified by:
getLastAccessedTimeInternalin interfaceSession- Returns:
- the last client access time without invalidation check
- See Also:
Session.getLastAccessedTime()
-
getIdleTime
public long getIdleTime()
- Specified by:
getIdleTimein interfaceSession- Returns:
- the idle time (in milliseconds) from last client access time.
-
getIdleTimeInternal
public long getIdleTimeInternal()
- Specified by:
getIdleTimeInternalin interfaceSession- Returns:
- the idle time from last client access time without invalidation check
- See Also:
Session.getIdleTime()
-
getManager
public Manager getManager()
- Specified by:
getManagerin interfaceSession- Returns:
- the Manager within which this Session is valid.
-
setManager
public void setManager(Manager manager)
Description copied from interface:SessionSet the Manager within which this Session is valid.- Specified by:
setManagerin interfaceSession- Parameters:
manager- The new Manager
-
getMaxInactiveInterval
public int getMaxInactiveInterval()
Description copied from interface:jakarta.servlet.http.HttpSessionReturns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session. The maximum time interval can be set with thesetMaxInactiveIntervalmethod. A zero or negative time indicates that the session should never timeout.- Specified by:
getMaxInactiveIntervalin interfaceHttpSession- Specified by:
getMaxInactiveIntervalin interfaceSession- Returns:
- an integer specifying the number of seconds this session remains open between client requests
- See Also:
HttpSession.setMaxInactiveInterval(int)
-
setMaxInactiveInterval
public void setMaxInactiveInterval(int interval)
Description copied from interface:jakarta.servlet.http.HttpSessionSpecifies the time, in seconds, between client requests before the servlet container will invalidate this session. A zero or negative time indicates that the session should never timeout.- Specified by:
setMaxInactiveIntervalin interfaceHttpSession- Specified by:
setMaxInactiveIntervalin interfaceSession- Parameters:
interval- An integer specifying the number of seconds
-
setNew
public void setNew(boolean isNew)
Description copied from interface:SessionSet theisNewflag for this session.
-
getPrincipal
public java.security.Principal getPrincipal()
- Specified by:
getPrincipalin interfaceSession- Returns:
- the authenticated Principal that is associated with this Session. This provides an
Authenticatorwith a means to cache a previously authenticated Principal, and avoid potentially expensiveRealm.authenticate()calls on every request. If there is no current associated Principal, returnnull.
-
setPrincipal
public void setPrincipal(java.security.Principal principal)
Description copied from interface:SessionSet the authenticated Principal that is associated with this Session. This provides anAuthenticatorwith a means to cache a previously authenticated Principal, and avoid potentially expensiveRealm.authenticate()calls on every request.- Specified by:
setPrincipalin interfaceSession- Parameters:
principal- The new Principal, ornullif none
-
getSession
public HttpSession getSession()
- Specified by:
getSessionin interfaceSession- Returns:
- the
HttpSessionfor which this object is the facade.
-
isValid
public boolean isValid()
-
setValid
public void setValid(boolean isValid)
Description copied from interface:SessionSet theisValidflag for this session.
-
access
public void access()
Description copied from interface:SessionUpdate 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.
-
endAccess
public void endAccess()
Description copied from interface:SessionEnd access to the session.
-
addSessionListener
public void addSessionListener(SessionListener listener)
Description copied from interface:SessionAdd a session event listener to this component.- Specified by:
addSessionListenerin interfaceSession- Parameters:
listener- the SessionListener instance that should be notified for session events
-
expire
public void expire()
Description copied from interface:SessionPerform the internal processing required to invalidate this session, without triggering an exception if the session has already expired.
-
expire
public void expire(boolean notify)
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 of this session?
-
passivate
public void passivate()
Perform the internal processing required to passivate this session.
-
activate
public void activate()
Perform internal processing required to activate this session.
-
getNote
public java.lang.Object getNote(java.lang.String name)
-
getNoteNames
public java.util.Iterator<java.lang.String> getNoteNames()
- Specified by:
getNoteNamesin interfaceSession- Returns:
- an Iterator containing the String names of all notes bindings that exist for this session.
-
recycle
public void recycle()
Description copied from interface:SessionRelease all object references, and initialize instance variables, in preparation for reuse of this object.
-
removeNote
public void removeNote(java.lang.String name)
Description copied from interface:SessionRemove any object bound to the specified name in the internal notes for this session.- Specified by:
removeNotein interfaceSession- Parameters:
name- Name of the note to be removed
-
removeSessionListener
public void removeSessionListener(SessionListener listener)
Description copied from interface:SessionRemove a session event listener from this component.- Specified by:
removeSessionListenerin interfaceSession- Parameters:
listener- remove the session listener, which will no longer be notified
-
setNote
public void setNote(java.lang.String name, java.lang.Object value)Description copied from interface:SessionBind an object to a specified name in the internal notes associated with this session, replacing any existing binding for this name.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
readObjectData
public void readObjectData(java.io.ObjectInputStream stream) throws java.lang.ClassNotFoundException, java.io.IOExceptionRead 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- Throws:
java.lang.ClassNotFoundException- if an unknown class is specifiedjava.io.IOException- if an input/output error occurs
-
writeObjectData
public void writeObjectData(java.io.ObjectOutputStream stream) throws java.io.IOExceptionWrite 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- Throws:
java.io.IOException- if an input/output error occurs
-
getCreationTime
public long getCreationTime()
Description copied from interface:jakarta.servlet.http.HttpSessionReturns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.- Specified by:
getCreationTimein interfaceHttpSession- Specified by:
getCreationTimein interfaceSession- Returns:
- a
longspecifying when this session was created, expressed in milliseconds since 1/1/1970 GMT
-
getCreationTimeInternal
public long getCreationTimeInternal()
- Specified by:
getCreationTimeInternalin interfaceSession- Returns:
- the creation time for this session, bypassing the session validity checks.
-
getServletContext
public ServletContext getServletContext()
Description copied from interface:jakarta.servlet.http.HttpSessionReturns the ServletContext to which this session belongs.- Specified by:
getServletContextin interfaceHttpSession- Returns:
- The ServletContext object for the web application
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
Description copied from interface:jakarta.servlet.http.HttpSessionReturns the object bound with the specified name in this session, ornullif no object is bound under the name.- Specified by:
getAttributein interfaceHttpSession- Parameters:
name- a string specifying the name of the object- Returns:
- the object with the specified name
-
getAttributeNames
public java.util.Enumeration<java.lang.String> getAttributeNames()
Description copied from interface:jakarta.servlet.http.HttpSessionReturns anEnumerationofStringobjects containing the names of all the objects bound to this session.- Specified by:
getAttributeNamesin interfaceHttpSession- Returns:
- an
EnumerationofStringobjects specifying the names of all the objects bound to this session
-
invalidate
public void invalidate()
Description copied from interface:jakarta.servlet.http.HttpSessionInvalidates this session then unbinds any objects bound to it.- Specified by:
invalidatein interfaceHttpSession
-
isNew
public boolean isNew()
Description copied from interface:jakarta.servlet.http.HttpSessionReturnstrueif 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 had disabled the use of cookies, then a session would be new on each request.- Specified by:
isNewin interfaceHttpSession- Returns:
trueif the server has created a session, but the client has not yet joined
-
removeAttribute
public void removeAttribute(java.lang.String name)
Description copied from interface:jakarta.servlet.http.HttpSessionRemoves the object bound with the specified name from this session. If the session does not have an object bound with the specified name, this method does nothing.After this method executes, and if the object implements
HttpSessionBindingListener, the container callsHttpSessionBindingListener.valueUnbound. The container then notifies anyHttpSessionAttributeListeners in the web application.- Specified by:
removeAttributein interfaceHttpSession- Parameters:
name- the name of the object to remove from this session
-
removeAttribute
public void removeAttribute(java.lang.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 callsvalueUnbound()on the object.- Parameters:
name- Name of the object to remove from this session.notify- Should we notify interested listeners that this attribute is being removed?- Throws:
java.lang.IllegalStateException- if this method is called on an invalidated session
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)Description copied from interface:jakarta.servlet.http.HttpSessionBinds an object to this session, using the name specified. If an object of the same name is already bound to the session, the object is replaced.After this method executes, and if the new object implements
HttpSessionBindingListener, the container callsHttpSessionBindingListener.valueBound. The container then notifies anyHttpSessionAttributeListeners in the web application.If an object was already bound to this session of this name that implements
HttpSessionBindingListener, itsHttpSessionBindingListener.valueUnboundmethod is called.If the value passed in is null, this has the same effect as calling
removeAttribute().- Specified by:
setAttributein interfaceHttpSession- Parameters:
name- the name to which the object is bound; cannot be nullvalue- the object to be bound
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value, boolean notify)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 callsvalueBound()on the object.- Parameters:
name- Name to which the object is bound, cannot be nullvalue- Object to be bound, cannot be nullnotify- whether to notify session listeners- Throws:
java.lang.IllegalArgumentException- if an attempt is made to add a non-serializable object in an environment marked distributable.java.lang.IllegalStateException- if this method is called on an invalidated session
-
isValidInternal
protected boolean isValidInternal()
- Returns:
- the
isValidflag for this session without any expiration check.
-
isAttributeDistributable
public boolean isAttributeDistributable(java.lang.String name, java.lang.Object value)Does the session implementation support the distributing of the given attribute? If the Manager is marked as distributable, then this method must be used to check attributes before adding them to a session and anIllegalArgumentExceptionthrown if the proposed attribute is not distributable.Note that the
Managerimplementation may further restrict which attributes are distributed but aManagerlevel restriction should not trigger anIllegalArgumentExceptioninHttpSession.setAttribute(String, Object)This implementation simply checks the value for serializability. Subclasses might use other distribution technology not based on serialization and can override this check.
- Specified by:
isAttributeDistributablein interfaceSession- Parameters:
name- The attribute namevalue- The attribute value- Returns:
trueif distribution is supported, otherwisefalse
-
doReadObject
protected void doReadObject(java.io.ObjectInputStream stream) throws java.lang.ClassNotFoundException, java.io.IOExceptionRead a serialized version of this session object from the specified object input stream.IMPLEMENTATION NOTE: The reference to the owning Manager is not restored by this method, and must be set explicitly.
- Parameters:
stream- The input stream to read from- Throws:
java.lang.ClassNotFoundException- if an unknown class is specifiedjava.io.IOException- if an input/output error occurs
-
doWriteObject
protected void doWriteObject(java.io.ObjectOutputStream stream) throws java.io.IOExceptionWrite a serialized version of this session object to the specified object output stream.IMPLEMENTATION NOTE: The owning Manager will not be stored in the serialized representation of this Session. After calling
readObject(), you must set the associated Manager explicitly.IMPLEMENTATION NOTE: Any attribute that is not Serializable will be unbound from the session, with appropriate actions if it implements HttpSessionBindingListener. If you do not want any such attributes, be sure the
distributableproperty of the associated Manager is set totrue.- Parameters:
stream- The output stream to write to- Throws:
java.io.IOException- if an input/output error occurs
-
exclude
protected boolean exclude(java.lang.String name, java.lang.Object value)Should the given session attribute be excluded? This implementation checks: Note: This method deliberately does not checkisAttributeDistributable(String, Object)which is kept separate to support the checks required insetAttribute(String, Object, boolean)- Parameters:
name- The attribute namevalue- The attribute value- Returns:
trueif the attribute should be excluded from distribution, otherwisefalse
-
fireSessionEvent
public void fireSessionEvent(java.lang.String type, java.lang.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.- Parameters:
type- Event typedata- Event data
-
keys
protected java.lang.String[] keys()
- Returns:
- 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.
-
removeAttributeInternal
protected void removeAttributeInternal(java.lang.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 callsvalueUnbound()on the object.- Parameters:
name- Name of the object to remove from this session.notify- Should we notify interested listeners that this attribute is being removed?
-
-