com.vaadin.flow.server.startup.

Class ApplicationRouteRegistry

    • Constructor Detail

      • ApplicationRouteRegistry

        protected ApplicationRouteRegistry()

        Creates a new uninitialized route registry.

    • Method Detail

      • getInstance

        public static ApplicationRouteRegistry getInstance(VaadinContext context)

        Gets the route registry for the given Vaadin context. If the Vaadin context has no route registry, a new instance is created and assigned to the context.

        Parameters:

        context - the vaadin context for which to get a route registry, not null

        Returns:

        a registry instance for the given servlet context, not null

      • setErrorNavigationTargets

        public void setErrorNavigationTargets(Set<Class<? extends Component>> errorNavigationTargets)

        Set error handler navigation targets.

        This can also be used to add error navigation targets that override existing targets. Note! The overriding targets need to be extending the existing target or they will throw.

        Parameters:

        errorNavigationTargets - error handler navigation targets

      • getErrorNavigationTarget

        public Optional<ErrorTargetEntry> getErrorNavigationTarget(Exception exception)

        Get a registered navigation target for given exception. First we will search for a matching cause for in the exception chain and if no match found search by extended type.

        Parameters:

        exception - exception to search error view for

        Returns:

        optional error target entry corresponding to the given exception

      • getNavigationRouteTarget

        public NavigationRouteTarget getNavigationRouteTarget(String url)

        Description copied from interface: RouteRegistry

        Search for a route target using given navigation url argument.

        Parameters:

        url - the navigation url used to search a route target.

        Returns:

        a NavigationRouteTarget instance containing the RouteTarget and RouteParameters extracted from the url argument according with the route configuration.

      • getRouteTarget

        public RouteTarget getRouteTarget(Class<? extends Component> target,
                                          RouteParameters parameters)

        Description copied from interface: RouteRegistry

        Gets the RouteTarget instance matching the given target component and route parameters.

        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.

      • getNavigationTarget

        public Optional<Class<? extends Component>> getNavigationTarget(String url)

        Description copied from interface: RouteRegistry

        Gets the optional navigation target class for a given path. Returns an empty optional if no navigation target corresponds to the given url.

        Parameters:

        url - the path to get the navigation target for, not null

        Returns:

        optional of the navigation target corresponding to the given path

      • getNavigationTarget

        public Optional<Class<? extends Component>> getNavigationTarget(String url,
                                                                        List<String> segments)

        Description copied from interface: RouteRegistry

        Gets the optional navigation target class for a given Location matching with path segments.

        Parameters:

        url - path to get navigation target for, not null

        segments - segments given for path

        Returns:

        optional navigation target corresponding to the given location with given segments if any applicable targets found.

        See Also:

        Location

      • hasNavigationTargets

        public boolean hasNavigationTargets()

        Check if there are registered navigation targets in the registry.

        Returns:

        true if any navigation are registered

      • getPwaConfigurationClass

        public Class<?> getPwaConfigurationClass()

        Gets pwa configuration class.

        Returns:

        a class that has PWA-annotation.

      • setPwaConfigurationClass

        public void setPwaConfigurationClass(Class<?> pwaClass)

        Sets pwa configuration class. Should be set along with setRoutes, for scanning of proper pwa configuration class is done along route scanning. See AbstractRouteRegistryInitializer.

        Parameters:

        pwaClass - a class that has PWA -annotation, that's to be used in service initialization.

      • handleInitializedRegistry

        protected void handleInitializedRegistry()

        Handles an attempt to initialize already initialized route registry.