Interface SessionData


  • public interface SessionData
    The data associated with the user session.

    The session data can be obtained via the Session.getData() method.

    Every item is stored with a SessionKey. A key is comprised of a type (as a Class) and an optional name. The combination of type and name identifies the value. Two keys with differing types but identical names are not considered to be equivalent.

    When writing session data, the values are serialized immediately. That is, all objects are treated as immutable value objects from the perspective of this object. Any changes made to an object after it has been written to this object will NOT be persisted. If such changes are to be persisted, the object must be written again.

    If a SessionSerializer is not provided for a given get/set, the getDefaultSerializer() will be used. The SessionModule provides a default implementation based on Java serialization. An alternative implementation can be used by overriding the Guice binding for SessionSerializer.

    The session data is held in memory for a given request until the Session.save() method is called on the corresponding session. However, this object internally holds the data in serialized form. Therefore, every read and write incurs the cost of serialization and deserialization.