Class ObjectStreamSessionDataStore

All Implemented Interfaces:
SessionDataMap, SessionDataStore, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle
Direct Known Subclasses:
FileSessionDataStore, JDBCSessionDataStore

public abstract class ObjectStreamSessionDataStore extends AbstractSessionDataStore
  • Constructor Details

    • ObjectStreamSessionDataStore

      public ObjectStreamSessionDataStore()
  • Method Details

    • newObjectOutputStream

      public ObjectOutputStream newObjectOutputStream(OutputStream os) throws IOException
      Get an ObjectOutputStream suitable to serialize SessionData objects into the provided OutputStream.
      By default, an ObjectObjectStream is returned.
      Override this method to provide a custom ObjectOutputStream, and/or to chain other OutputStreams to perform such tasks as compressing the serialized data, for example:
      GZIPOutputStream gos = new GZIPOutputStream(os); return new ObjectOutputStream(gos);
      Parameters:
      os - an output stream to which to serialize the session data
      Returns:
      an ObjectOutputStream wrapping the OutputStream
      Throws:
      IOException - if the stream cannot be created
    • newObjectInputStream

      protected ObjectInputStream newObjectInputStream(InputStream is) throws IOException
      Get an ObjectInputStream that is capable of deserializing the session data present in the provided InputStream.
      By default, a Classloader-aware ObjectInputStream is used, however, you can return your own specialized ObjectInputStream, or chain other InputStreams together to perform such tasks as data decompression, for example:
      GZIPInputStream gis = new GZIPInputStream(is); return new ClassLoadingObjectInputStream(is)
      Parameters:
      is - an input stream for accessing the session data to be deserialized
      Returns:
      an ObjectInputStream that can deserialize the session data
      Throws:
      IOException - if the stream cannot be created
    • serializeAttributes

      protected void serializeAttributes(SessionData data, OutputStream os) throws Exception
      Serialize the attribute map of the SessionData into the OutputStream provided.
      Parameters:
      data - the SessionData whose attributes are to be serialized
      os - the OutputStream to receive the serialized attributes
      Throws:
      Exception - if the attributes cannot be serialized
    • deserializeAttributes

      protected void deserializeAttributes(SessionData data, InputStream is) throws Exception
      Deserialize the attribute map from the InputStream provided and store into the SessionData.
      Parameters:
      data - the SessionData into which to deserialize the attributes
      is - the InputStream for reading the serialized attributes
      Throws:
      Exception - if the attributes cannot be deserialized