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 ClassesModifier and TypeClassDescriptionstatic classstatic classVaadinServiceInitListenerimplementation that installs theSerializationDebugRequestHandlerif 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 onjava.iopackages is allowed by adding '--add-opens java.base/java.io=ALL-UNNAMED' flag to the JVM. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSerializationDebugRequestHandler(SerializationProperties serializationProperties) -
Method Summary
Modifier and TypeMethodDescriptionbooleanhandleRequest(com.vaadin.flow.server.VaadinSession vaadinSession, com.vaadin.flow.server.VaadinRequest vaadinRequest, com.vaadin.flow.server.VaadinResponse vaadinResponse) voidonApplicationEvent(org.springframework.context.event.ContextClosedEvent event) static voidserializeAndDeserialize(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, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Field Details
-
SERIALIZATION_TEST_REQUEST_ATTRIBUTE_KEY
-
-
Constructor Details
-
SerializationDebugRequestHandler
-
-
Method Details
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.event.ContextClosedEvent event) - Specified by:
onApplicationEventin interfaceorg.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:
handleRequestin interfacecom.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.
-