Package org.dellroad.stuff.vaadin24.util
Class VaadinSessionFinder
java.lang.Object
org.dellroad.stuff.vaadin24.util.VaadinSessionFinder
Utility class for finding the
VaadinSession
associated with the current HTTP request
when VaadinSession.getCurrent()
isn't an option.
This class requires that Spring's RequestContextHolder
is being used.
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Invoke the given action in the context of theVaadinSession
associated with the current HTTP request.static Optional<VaadinSession>
find()
Find theVaadinSession
associated with the current HTTP request.
-
Method Details
-
find
Find theVaadinSession
associated with the current HTTP request.The session is found by directly inspecting the current HTTP session, so this will work even if the current thread is not executing within the Vaadin servlet.
This method relies on Spring's
RequestContextHolder
to locate the current HTTP request.- Returns:
- the
VaadinSession
associated with the current HTTP request, if any
-
access
Invoke the given action in the context of theVaadinSession
associated with the current HTTP request.- Parameters:
action
- the action to perform- Returns:
- true if successfully dispatched, false if
session
was not found - Throws:
IllegalArgumentException
- ifaction
is null
-