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 booleanInvoke the given action in the context of theVaadinSessionassociated with the current HTTP request.static Optional<VaadinSession>find()Find theVaadinSessionassociated with the current HTTP request.
-
Method Details
-
find
Find theVaadinSessionassociated 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
RequestContextHolderto locate the current HTTP request.- Returns:
- the
VaadinSessionassociated with the current HTTP request, if any
-
access
Invoke the given action in the context of theVaadinSessionassociated with the current HTTP request.- Parameters:
action- the action to perform- Returns:
- true if successfully dispatched, false if
sessionwas not found - Throws:
IllegalArgumentException- ifactionis null
-