com.vaadin.flow.server.
Class SessionRouteRegistry
All Implemented Interfaces:
SessionRouteRegistry is a mutable route registry that is valid in the scope of VaadinSession. Routes can be added and removed from this registry and any overlap with the registered routes between session and global scope will be handled so that session scope paths overrides global paths.
Since:
1.3
See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.router.internal.AbstractRouteRegistry
AbstractRouteRegistry.Configuration
-
Method Summary
Modifier and TypeMethodDescriptionaddRoutesChangeListener
(RoutesChangedListener listener) Adds the given route change listener to the registry.
Gets the Vaadin context which the registry belongs to.
Class<? extends RouterLayout>
Get the layout component for the current path.
Search for a route target using given navigation
url
argument.Gets the optional navigation target class for a given path.
getNavigationTarget
(String url, List<String> segments) Gets the optional navigation target class for a given Location matching with path segments.
Get the
RouteData
for all registered navigation targets.getRouteTarget
(Class<? extends Component> target, RouteParameters parameters) Gets the
RouteTarget
instance matching the given target component and route parameters.static RouteRegistry
getSessionRegistry
(VaadinSession session) Get the session registry for VaadinSession.
getTargetUrl
(Class<? extends Component> navigationTarget) Get the url string for given navigation target.
getTargetUrl
(Class<? extends Component> navigationTarget, RouteParameters parameters) Get the url string for given navigation target.
getTemplate
(Class<? extends Component> navigationTarget) Get the main template for given navigation target.
boolean
Check if a layout component has been registered for the current path.
Methods inherited from class com.vaadin.flow.router.internal.AbstractRouteRegistry
addErrorTarget, clean, configure, fireEvent, getConfiguration, getRegisteredAccessibleMenuRoutes, hasLock, hasMandatoryParameter, removeRoute, removeRoute, removeRoute, searchByCause, searchBySuperType, setLayout, setRoute, update
-
Method Details
-
getSessionRegistry
Get the session registry for VaadinSession. If no SessionRegistry exists then one will be created for given VaadinSession.
Parameters:
session
- vaadin session to get registry forReturns:
session registry for given session
-
getRegisteredRoutes
Description copied from interface:
RouteRegistry
Get the
RouteData
for all registered navigation targets.Specified by:
getRegisteredRoutes
in interfaceRouteRegistry
Overrides:
getRegisteredRoutes
in classAbstractRouteRegistry
Returns:
list of routes available for this registry
-
addRoutesChangeListener
Adds the given route change listener to the registry.
For the session scoped registry also changes to the application scoped registry will be delegated to the listener if the added or removed route was not masked by a registration in the session scope.
Specified by:
addRoutesChangeListener
in interfaceRouteRegistry
Overrides:
addRoutesChangeListener
in classAbstractRouteRegistry
Parameters:
listener
- listener to addReturns:
registration to remove the listener
-
getRouteTarget
Description copied from interface:
RouteRegistry
Gets the
RouteTarget
instance matching the given target component and route parameters.Specified by:
getRouteTarget
in interfaceRouteRegistry
Overrides:
getRouteTarget
in classAbstractRouteRegistry
Parameters:
target
- a component class which is a navigation target.parameters
- parameter values that may be used with given target.Returns:
the
RouteTarget
instance matching the given target component and route parameters. -
getTargetUrl
Description copied from interface:
RouteRegistry
Get the url string for given navigation target.
Specified by:
getTargetUrl
in interfaceRouteRegistry
Overrides:
getTargetUrl
in classAbstractRouteRegistry
Parameters:
navigationTarget
- navigation target to get registered route for, notnull
Returns:
Optional
navigation target url string orOptional.empty()
if navigation target was not found -
getTargetUrl
public Optional<String> getTargetUrl(Class<? extends Component> navigationTarget, RouteParameters parameters) Description copied from interface:
RouteRegistry
Get the url string for given navigation target.
Specified by:
getTargetUrl
in interfaceRouteRegistry
Overrides:
getTargetUrl
in classAbstractRouteRegistry
Parameters:
navigationTarget
- navigation target to get registered route for, notnull
parameters
- parameters for the target url.Returns:
Optional
navigation target url string orOptional.empty()
if navigation target was not found -
getTemplate
Description copied from interface:
RouteRegistry
Get the main template for given navigation target.
In case of annotated target the main template is composed of the
Route
annotation value prefixed by allRoutePrefix
values of the parentRouterLayout
s chain.Specified by:
getTemplate
in interfaceRouteRegistry
Overrides:
getTemplate
in classAbstractRouteRegistry
Parameters:
navigationTarget
- navigation target to get route definition for, notnull
Returns:
Optional
navigation target template string orOptional.empty()
if navigation target was not found -
getContext
Description copied from interface:
RouteRegistry
Gets the Vaadin context which the registry belongs to.
Returns:
the Vaadin context
-
getLayout
Description copied from interface:
RouteRegistry
Get the layout component for the current path.
Specified by:
getLayout
in interfaceRouteRegistry
Overrides:
getLayout
in classAbstractRouteRegistry
Parameters:
path
- current pathReturns:
RouterLayout
component or null -
hasLayout
Description copied from interface:
RouteRegistry
Check if a layout component has been registered for the current path.
Specified by:
hasLayout
in interfaceRouteRegistry
Overrides:
hasLayout
in classAbstractRouteRegistry
Parameters:
path
- current pathReturns:
true
if layout exists
-