Package com.vaadin.flow.server
Class SessionRouteRegistry
java.lang.Object
com.vaadin.flow.router.internal.AbstractRouteRegistry
com.vaadin.flow.server.SessionRouteRegistry
- All Implemented Interfaces:
RouteRegistry,Serializable
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 navigationurlargument.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 theRouteDatafor all registered navigation targets.getRouteTarget(Class<? extends Component> target, RouteParameters parameters) Gets theRouteTargetinstance matching the given target component and route parameters.static RouteRegistrygetSessionRegistry(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.booleanCheck 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 for- Returns:
- session registry for given session
-
getRegisteredRoutes
Description copied from interface:RouteRegistryGet theRouteDatafor all registered navigation targets.- Specified by:
getRegisteredRoutesin interfaceRouteRegistry- Overrides:
getRegisteredRoutesin 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:
addRoutesChangeListenerin interfaceRouteRegistry- Overrides:
addRoutesChangeListenerin classAbstractRouteRegistry- Parameters:
listener- listener to add- Returns:
- registration to remove the listener
-
getRouteTarget
Description copied from interface:RouteRegistryGets theRouteTargetinstance matching the given target component and route parameters.- Specified by:
getRouteTargetin interfaceRouteRegistry- Overrides:
getRouteTargetin classAbstractRouteRegistry- Parameters:
target- a component class which is a navigation target.parameters- parameter values that may be used with given target.- Returns:
- the
RouteTargetinstance matching the given target component and route parameters.
-
getTargetUrl
Description copied from interface:RouteRegistryGet the url string for given navigation target.- Specified by:
getTargetUrlin interfaceRouteRegistry- Overrides:
getTargetUrlin classAbstractRouteRegistry- Parameters:
navigationTarget- navigation target to get registered route for, notnull- Returns:
Optionalnavigation 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:RouteRegistryGet the url string for given navigation target.- Specified by:
getTargetUrlin interfaceRouteRegistry- Overrides:
getTargetUrlin classAbstractRouteRegistry- Parameters:
navigationTarget- navigation target to get registered route for, notnullparameters- parameters for the target url.- Returns:
Optionalnavigation target url string orOptional.empty()if navigation target was not found
-
getTemplate
Description copied from interface:RouteRegistryGet the main template for given navigation target.In case of annotated target the main template is composed of the
Routeannotation value prefixed by allRoutePrefixvalues of the parentRouterLayouts chain.- Specified by:
getTemplatein interfaceRouteRegistry- Overrides:
getTemplatein classAbstractRouteRegistry- Parameters:
navigationTarget- navigation target to get route definition for, notnull- Returns:
Optionalnavigation target template string orOptional.empty()if navigation target was not found
-
getContext
Description copied from interface:RouteRegistryGets the Vaadin context which the registry belongs to.- Returns:
- the Vaadin context
-
getLayout
Description copied from interface:RouteRegistryGet the layout component for the current path.- Specified by:
getLayoutin interfaceRouteRegistry- Overrides:
getLayoutin classAbstractRouteRegistry- Parameters:
path- current path- Returns:
RouterLayoutcomponent or null
-
hasLayout
Description copied from interface:RouteRegistryCheck if a layout component has been registered for the current path.- Specified by:
hasLayoutin interfaceRouteRegistry- Overrides:
hasLayoutin classAbstractRouteRegistry- Parameters:
path- current path- Returns:
trueif layout exists
-