Class SessionData
- java.lang.Object
-
- com.aspectran.core.component.session.SessionData
-
- All Implemented Interfaces:
java.io.Serializable
public class SessionData extends java.lang.Object implements java.io.SerializableThe data associated with a session.Created: 2017. 6. 6.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SessionData(java.lang.String id, long created, long accessed, long lastAccessed, long inactiveInterval)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcalcAndSetExpiry()voidcalcAndSetExpiry(long time)longcalcExpiry()longcalcExpiry(long time)voidclearAllAttributes()Removes all attributes.static SessionDatadeserialize(java.io.InputStream is)Load session data from an input stream that contains session data.longgetAccessed()java.util.Map<java.lang.String,java.lang.Object>getAllAttributes()Returns an unmodifiable map of the attributes.<T> TgetAttribute(java.lang.String name)longgetCreated()longgetExpiry()java.lang.StringgetId()longgetInactiveInterval()java.util.Set<java.lang.String>getKeys()longgetLastAccessed()longgetLastSaved()booleanisDirty()booleanisExpiredAt(long time)voidputAllAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)Copies all of the mappings from the specified attributes.static voidserialize(SessionData data, java.io.OutputStream os, java.util.Set<java.lang.String> nonPersistentAttributes)Save the session data.voidsetAccessed(long accessed)<T> TsetAttribute(java.lang.String name, java.lang.Object value)voidsetDirty(boolean dirty)voidsetExpiry(long expiry)voidsetId(java.lang.String id)voidsetInactiveInterval(long inactiveInterval)voidsetLastAccessed(long lastAccessed)voidsetLastSaved(long lastSaved)java.lang.StringtoString()
-
-
-
Method Detail
-
getId
public java.lang.String getId()
-
setId
public void setId(java.lang.String id)
-
getCreated
public long getCreated()
-
getAccessed
public long getAccessed()
-
setAccessed
public void setAccessed(long accessed)
-
getLastAccessed
public long getLastAccessed()
-
setLastAccessed
public void setLastAccessed(long lastAccessed)
-
getInactiveInterval
public long getInactiveInterval()
-
setInactiveInterval
public void setInactiveInterval(long inactiveInterval)
-
getExpiry
public long getExpiry()
-
setExpiry
public void setExpiry(long expiry)
-
calcExpiry
public long calcExpiry()
-
calcExpiry
public long calcExpiry(long time)
-
calcAndSetExpiry
public void calcAndSetExpiry()
-
calcAndSetExpiry
public void calcAndSetExpiry(long time)
-
isExpiredAt
public boolean isExpiredAt(long time)
-
isDirty
public boolean isDirty()
- Returns:
- true if a session needs to be written out
-
setDirty
public void setDirty(boolean dirty)
-
getLastSaved
public long getLastSaved()
-
setLastSaved
public void setLastSaved(long lastSaved)
-
getAttribute
public <T> T getAttribute(java.lang.String name)
-
setAttribute
public <T> T setAttribute(java.lang.String name, java.lang.Object value)
-
getKeys
public java.util.Set<java.lang.String> getKeys()
- Returns:
- a Set of attribute names
-
getAllAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAllAttributes()
Returns an unmodifiable map of the attributes.- Returns:
- an unmodifiable map of the attributes
-
putAllAttributes
public void putAllAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
Copies all of the mappings from the specified attributes.- Parameters:
attributes- the specified attributes
-
clearAllAttributes
public void clearAllAttributes()
Removes all attributes.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
serialize
public static void serialize(SessionData data, java.io.OutputStream os, java.util.Set<java.lang.String> nonPersistentAttributes) throws java.io.IOException
Save the session data.- Parameters:
os- the output stream to save tononPersistentAttributes- the attribute names to be excluded from serialization- Throws:
java.io.IOException- if an I/O error has occurred
-
deserialize
public static SessionData deserialize(java.io.InputStream is) throws java.lang.Exception
Load session data from an input stream that contains session data.- Parameters:
is- the input stream containing session data- Returns:
- the session data
- Throws:
java.lang.Exception- if the session data could not be read from the file
-
-