Class KryoSessionSerializer

  • All Implemented Interfaces:
    ratpack.session.JavaSessionSerializer, ratpack.session.SessionSerializer

    public class KryoSessionSerializer
    extends java.lang.Object
    implements ratpack.session.JavaSessionSerializer
    A Kryo based session data serialization implementation.

    For use in combination with SessionModule. To use, override the JavaSessionSerializer binding provided by that module with an instance of this class.

    This serializer supports session type filtering via SessionTypeFilter.

    Since:
    1.9
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void configureKryo​(com.esotericsoftware.kryo.kryo5.Kryo kryo)
      A hook for potential subclasses to configure Kryo instances used.
      <T> T deserialize​(java.lang.Class<T> type, java.io.InputStream in, ratpack.session.SessionTypeFilter typeFilter)  
      <T> void serialize​(java.lang.Class<T> type, T value, java.io.OutputStream out, ratpack.session.SessionTypeFilter typeFilter)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface ratpack.session.SessionSerializer

        deserialize, serialize
    • Constructor Detail

      • KryoSessionSerializer

        public KryoSessionSerializer()
    • Method Detail

      • configureKryo

        protected void configureKryo​(com.esotericsoftware.kryo.kryo5.Kryo kryo)
        A hook for potential subclasses to configure Kryo instances used.

        Internally, kryo instances are pooled and reused. This method may be called any time, as new instances are needed. All instances should be configured identically.

        Parameters:
        kryo - the instance to configure
      • serialize

        public <T> void serialize​(java.lang.Class<T> type,
                                  T value,
                                  java.io.OutputStream out,
                                  ratpack.session.SessionTypeFilter typeFilter)
                           throws java.lang.Exception
        Specified by:
        serialize in interface ratpack.session.SessionSerializer
        Throws:
        java.lang.Exception
      • deserialize

        public <T> T deserialize​(java.lang.Class<T> type,
                                 java.io.InputStream in,
                                 ratpack.session.SessionTypeFilter typeFilter)
                          throws java.lang.Exception
        Specified by:
        deserialize in interface ratpack.session.SessionSerializer
        Throws:
        java.lang.Exception