Class SessionData

java.lang.Object
com.aspectran.core.component.session.SessionData
All Implemented Interfaces:
Serializable

public class SessionData extends Object implements Serializable
The data associated with a session.

Created: 2017. 6. 6.

See Also:
  • Constructor Details

    • SessionData

      protected SessionData(String id, long created, long inactiveInterval)
    • SessionData

      protected SessionData(String id, long created, long accessed, long lastAccessed, long inactiveInterval)
  • Method Details

    • getId

      public String getId()
    • setId

      public void setId(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)
    • getExtraInactiveInterval

      protected long getExtraInactiveInterval()
    • setExtraInactiveInterval

      protected void setExtraInactiveInterval(long extraInactiveInterval)
    • reduceInactiveInterval

      public void reduceInactiveInterval(long inactiveInterval)
    • restoreInactiveInterval

      public boolean restoreInactiveInterval()
    • getExpiry

      public long getExpiry()
    • calcExpiry

      protected long calcExpiry(long time)
    • 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(String name)
    • setAttribute

      public <T> T setAttribute(String name, Object value)
    • removeAttribute

      public <T> T removeAttribute(String name)
    • getKeys

      public Set<String> getKeys()
      Returns:
      a Set of attribute names
    • getAllAttributes

      public Map<String,Object> getAllAttributes()
      Returns an unmodifiable map of the attributes.
      Returns:
      an unmodifiable map of the attributes
    • putAllAttributes

      public void putAllAttributes(Map<String,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 String toString()
      Overrides:
      toString in class Object
    • serialize

      public static void serialize(@NonNull SessionData data, OutputStream outputStream, Set<String> nonPersistentAttributes) throws IOException
      Save the session data.
      Parameters:
      outputStream - the output stream to save to
      nonPersistentAttributes - the attribute names to be excluded from serialization
      Throws:
      IOException - if an I/O error has occurred
    • deserialize

      @NonNull public static SessionData deserialize(InputStream inputStream) throws Exception
      Load session data from an input stream that contains session data.
      Parameters:
      inputStream - the input stream containing session data
      Returns:
      the session data
      Throws:
      Exception - if the session data could not be read from the file