Class SerializationDebugRequestHandler

java.lang.Object
com.vaadin.kubernetes.starter.sessiontracker.serialization.debug.SerializationDebugRequestHandler
All Implemented Interfaces:
com.vaadin.flow.server.RequestHandler, Serializable, EventListener, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextClosedEvent>

public class SerializationDebugRequestHandler extends Object implements com.vaadin.flow.server.RequestHandler, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextClosedEvent>
A RequestHandler implementation that performs a check on HTTP session serialization and deserialization. The request handler is executed only in development mode and if the vaadin.devmode.sessionSerialization.enabled configuration property is set to true. Potential exceptions are caught and logged in the server console. After running serialization and deserialization, detailed information are printed on server logs:
 - Process outcomes
 - List of not serializable classes
 - Deserialization stack in case of error
 - Potential causes of SerializedLambda ClassCastExceptions
   (e.g. self referencing lambdas)
 
Information are also stored in the form of Result object as request attribute, under the SERIALIZATION_TEST_REQUEST_ATTRIBUTE_KEY key. To get additional information about the serialization process issues set the -Dsun.io.serialization.extendedDebugInfo system property to true.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
    static class 
    VaadinServiceInitListener implementation that installs the SerializationDebugRequestHandler if the following preconditions are met: application is running in development mode. session serialization debug is enabled by setting the devmode.sessionSerialization.debug configuration property to true. sun.io.serialization.extendedDebugInfo system property is set to true. reflection on java.io packages is allowed by adding '--add-opens java.base/java.io=ALL-UNNAMED' flag to the JVM.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    handleRequest(com.vaadin.flow.server.VaadinSession vaadinSession, com.vaadin.flow.server.VaadinRequest vaadinRequest, com.vaadin.flow.server.VaadinResponse vaadinResponse)
     
    void
    onApplicationEvent(org.springframework.context.event.ContextClosedEvent event)
     
    static void
    serializeAndDeserialize(com.vaadin.flow.server.WrappedSession session, Consumer<Result> onComplete, int serializationTimeout)
    Deprecated, for removal: This API element is subject to removal in a future version.
    this method is not meant to be public.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.context.ApplicationListener

    supportsAsyncExecution
  • Field Details

    • SERIALIZATION_TEST_REQUEST_ATTRIBUTE_KEY

      public static final String SERIALIZATION_TEST_REQUEST_ATTRIBUTE_KEY
  • Constructor Details

    • SerializationDebugRequestHandler

      public SerializationDebugRequestHandler(SerializationProperties serializationProperties)
  • Method Details

    • onApplicationEvent

      public void onApplicationEvent(org.springframework.context.event.ContextClosedEvent event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextClosedEvent>
    • handleRequest

      public boolean handleRequest(com.vaadin.flow.server.VaadinSession vaadinSession, com.vaadin.flow.server.VaadinRequest vaadinRequest, com.vaadin.flow.server.VaadinResponse vaadinResponse)
      Specified by:
      handleRequest in interface com.vaadin.flow.server.RequestHandler
    • serializeAndDeserialize

      @Deprecated(forRemoval=true) public static void serializeAndDeserialize(com.vaadin.flow.server.WrappedSession session, Consumer<Result> onComplete, int serializationTimeout)
      Deprecated, for removal: This API element is subject to removal in a future version.
      this method is not meant to be public. Will be removed without replacement.