Top Description Fields Constructors Methods
org.eclipse.jetty.session

public Class SessionData

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.IOException, .Serializable, java.util.Collections, .Map, .Map.Entry, .Set, java.util.concurrent.ConcurrentHashMap, org.eclipse.jetty.util.ClassLoadingObjectInputStream, .ClassVisibilityChecker, org.slf4j.Logger, .LoggerFactory

SessionData The data associated with a session. A Session object has a 1:1 relationship with a SessionData object. The behaviour of sessions is implemented in the Session object (eg calling listeners, keeping timers etc). A Session's associated SessionData is the object which can be persisted, serialized etc.

Field Summary

Modifier and TypeField and Description
protected long
protected Map<String, Object>
protected String
protected long
protected long
protected boolean
protected long
protected String
protected long
protected String
protected long
protected long
protected boolean
protected String
private static final Logger
private static final long

Constructor Summary

AccessConstructor and Description
public
SessionData(String id, String cpath, String vhost, long created, long accessed, long lastAccessed, long maxInactiveMs)

public
SessionData(String id, String cpath, String vhost, long created, long accessed, long lastAccessed, long maxInactiveMs, Map<String, Object> attributes)

Method Summary

Modifier and TypeMethod and Description
public void
calcAndSetExpiry(long time)

public void
public long
public long
calcExpiry(long time)

public void
clean()

Clear all dirty flags.

public void
clearAllAttributes()

Remove all attributes

public void
copy(SessionData
the sessiondata to be copied
data
)

Copy the info from the given sessiondata

public static void
deserializeAttributes(SessionData
the SessionData for which to deserialize the attribute map
data
,
ObjectInputStream
the serialized stream
in
)

De-serialize the attribute map of a session.

public long

Returns:

time session was accessed
getAccessed
()

Get time session was accessed.

public Map<String, Object>
getAllAttributes()

Returns: an unmodifiable map of the attributes

public Object
getAttribute(String
the name of the attribute
name
)

Returns: the value of the attribute named

public String

Returns:

the context path associated with this session
getContextPath
()

Get the context path associated with this session.

public long

Returns:

time cookie was set
getCookieSet
()

Get time cookie was set.

public long
public long

Returns:

time at which session expires
getExpiry
()

Get time at which session expires.

public String

Returns:

the id of the session
getId
()

Get the id of the session.

public Set<String>
getKeys()

Returns: a Set of attribute names

public long

Returns:

previous time session was accessed
getLastAccessed
()

Get previous time session was accessed.

public String

Returns:

last node to manage the session
getLastNode
()

Get last node to manage the session.

public long

Returns:

time at which session was last written out
getLastSaved
()

Get time at which session was last written out.

public long
public String

Returns:

virtual host of context associated with session
getVhost
()

Get virtual host of context associated with session.

public boolean
isDirty()

Returns: true if a session needs to be written out

public boolean
isExpiredAt(long time)

public boolean
isMetaDataDirty()

Returns: the metaDataDirty

public void
private void
public static void
serializeAttributes(SessionData
the SessionData for which to serialize the attributes
data
,
ObjectOutputStream
the stream to which to serialize
out
)

Serialize the attribute map of the session.

public void
setAccessed(long accessed)

public Object
setAttribute(String name, Object value)

public void
setContextPath(String contextPath)

public void
setCookieSet(long cookieSet)

public void
setCreated(long created)

public void
setDirty(boolean dirty)

public void
public void
setExpiry(long expiry)

public void
public void
setLastAccessed(long lastAccessed)

public void
setLastNode(String lastNode)

public void
setLastSaved(long lastSaved)

public void
setMaxInactiveMs(long maxInactive)

public void
setMetaDataDirty(boolean
true means non-attribute data has changed
metaDataDirty
)

Set true means non-attribute data has changed.

public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_accessedback to summary
protected long _accessed
_attributesback to summary
protected Map<String, Object> _attributes
_contextPathback to summary
protected String _contextPath
_cookieSetback to summary
protected long _cookieSet
_createdback to summary
protected long _created
_dirtyback to summary
protected boolean _dirty
_expiryback to summary
protected long _expiry
_idback to summary
protected String _id
_lastAccessedback to summary
protected long _lastAccessed
_lastNodeback to summary
protected String _lastNode
_lastSavedback to summary
protected long _lastSaved
_maxInactiveMsback to summary
protected long _maxInactiveMs
_metaDataDirtyback to summary
protected boolean _metaDataDirty
_vhostback to summary
protected String _vhost
LOGback to summary
private static final Logger LOG
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

SessionDataback to summary
public SessionData(String id, String cpath, String vhost, long created, long accessed, long lastAccessed, long maxInactiveMs)
SessionDataback to summary
public SessionData(String id, String cpath, String vhost, long created, long accessed, long lastAccessed, long maxInactiveMs, Map<String, Object> attributes)

Method Detail

calcAndSetExpiryback to summary
public void calcAndSetExpiry(long time)
calcAndSetExpiryback to summary
public void calcAndSetExpiry()
calcExpiryback to summary
public long calcExpiry()
calcExpiryback to summary
public long calcExpiry(long time)
cleanback to summary
public void clean()

Clear all dirty flags.

clearAllAttributesback to summary
public void clearAllAttributes()

Remove all attributes

copyback to summary
public void copy(SessionData data)

Copy the info from the given sessiondata

Parameters
data:SessionData

the sessiondata to be copied

deserializeAttributesback to summary
public static void deserializeAttributes(SessionData data, ObjectInputStream in) throws IOException, ClassNotFoundException

De-serialize the attribute map of a session. When the session was serialized, we will have recorded which classloader should be used to recover the attribute value. The classloader could be the container classloader, or the webapp classloader.

Parameters
data:SessionData

the SessionData for which to deserialize the attribute map

in:ObjectInputStream

the serialized stream

getAccessedback to summary
public long getAccessed()

Get time session was accessed.

Returns:long

time session was accessed

getAllAttributesback to summary
public Map<String, Object> getAllAttributes()
Returns:Map<String, Object>

an unmodifiable map of the attributes

getAttributeback to summary
public Object getAttribute(String name)
Parameters
name:String

the name of the attribute

Returns:Object

the value of the attribute named

getContextPathback to summary
public String getContextPath()

Get the context path associated with this session.

Returns:String

the context path associated with this session

getCookieSetback to summary
public long getCookieSet()

Get time cookie was set.

Returns:long

time cookie was set

getCreatedback to summary
public long getCreated()
getExpiryback to summary
public long getExpiry()

Get time at which session expires.

Returns:long

time at which session expires

getIdback to summary
public String getId()

Get the id of the session.

Returns:String

the id of the session

getKeysback to summary
public Set<String> getKeys()
Returns:Set<String>

a Set of attribute names

getLastAccessedback to summary
public long getLastAccessed()

Get previous time session was accessed.

Returns:long

previous time session was accessed

getLastNodeback to summary
public String getLastNode()

Get last node to manage the session.

Returns:String

last node to manage the session

getLastSavedback to summary
public long getLastSaved()

Get time at which session was last written out.

Returns:long

time at which session was last written out

getMaxInactiveMsback to summary
public long getMaxInactiveMs()
getVhostback to summary
public String getVhost()

Get virtual host of context associated with session.

Returns:String

virtual host of context associated with session

isDirtyback to summary
public boolean isDirty()
Returns:boolean

true if a session needs to be written out

isExpiredAtback to summary
public boolean isExpiredAt(long time)
isMetaDataDirtyback to summary
public boolean isMetaDataDirty()
Returns:boolean

the metaDataDirty

putAllAttributesback to summary
public void putAllAttributes(Map<String, Object> attributes)
readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
serializeAttributesback to summary
public static void serializeAttributes(SessionData data, ObjectOutputStream out) throws IOException

Serialize the attribute map of the session. This special handling allows us to record which classloader should be used to load the value of the attribute: either the container classloader (which could be the application loader ie null, or jetty's startjar loader) or the webapp's classloader.

Parameters
data:SessionData

the SessionData for which to serialize the attributes

out:ObjectOutputStream

the stream to which to serialize

setAccessedback to summary
public void setAccessed(long accessed)
setAttributeback to summary
public Object setAttribute(String name, Object value)
setContextPathback to summary
public void setContextPath(String contextPath)
setCookieSetback to summary
public void setCookieSet(long cookieSet)
setCreatedback to summary
public void setCreated(long created)
setDirtyback to summary
public void setDirty(boolean dirty)
setDirtyback to summary
public void setDirty(String name)
setExpiryback to summary
public void setExpiry(long expiry)
setIdback to summary
public void setId(String id)
setLastAccessedback to summary
public void setLastAccessed(long lastAccessed)
setLastNodeback to summary
public void setLastNode(String lastNode)
setLastSavedback to summary
public void setLastSaved(long lastSaved)
setMaxInactiveMsback to summary
public void setMaxInactiveMs(long maxInactive)
setMetaDataDirtyback to summary
public void setMetaDataDirty(boolean metaDataDirty)

Set true means non-attribute data has changed.

Parameters
metaDataDirty:boolean

true means non-attribute data has changed

setVhostback to summary
public void setVhost(String vhost)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
writeObjectback to summary
private void writeObject(ObjectOutputStream out) throws IOException