Class NavigationStartedEvent
- All Implemented Interfaces:
Serializable
service event bus
when the server starts handling a navigation for a UI, before any
BeforeLeaveEvent or BeforeEnterEvent listener runs.
The event is meant for monitoring tools that time navigations or count them
per route. Every started event is followed by exactly one
NavigationEndedEvent for the same navigation, fired on the same
thread when the handling has finished, whatever the outcome. A listener can
therefore keep timing state in a ThreadLocal. Both events are fired
on the request thread while the session is locked.
Only the outermost navigation is reported. The navigations that Flow runs
while handling it are part of it and fire no events of their own: a
forward or
reroute, the redirect that adds or
removes a trailing slash, and the rendering of an error view. The ended event
tells which view was shown in the end.
Two cases fire no events at all, since they continue a navigation that has
already been reported: resuming a postponed navigation with
BeforeLeaveEvent.ContinueNavigationAction.proceed(), and showing a
PreserveOnRefresh view once the browser has sent its window name.
The location and trigger are the ones requested, as they are before any forward or reroute.
- Since:
- 25.4
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionNavigationStartedEvent(UI ui, Location location, NavigationTrigger trigger) Creates a new event. -
Method Summary
Modifier and TypeMethodDescriptionGets the location that was requested, before any forward or reroute.Gets the action that triggered the navigation, such as a page load, a click on a router link or a call toUI.navigate(String).getUI()Gets the UI that navigates.Methods inherited from class java.util.EventObject
getSource, toString
-
Constructor Details
-
Method Details
-
getUI
Gets the UI that navigates.- Returns:
- the UI, never
null
-
getLocation
Gets the location that was requested, before any forward or reroute.- Returns:
- the requested location, never
null
-
getTrigger
Gets the action that triggered the navigation, such as a page load, a click on a router link or a call toUI.navigate(String).- Returns:
- the navigation trigger, never
null
-