use of com.vaadin.flow.server.InvalidRouteConfigurationException in project flow by vaadin.
the class RouteRegistryInitializer method onStartup.
@Override
public void onStartup(Set<Class<?>> classSet, ServletContext servletContext) throws ServletException {
try {
if (classSet == null) {
RouteRegistry.getInstance(servletContext).setNavigationTargets(Collections.emptySet());
return;
}
Set<Class<? extends Component>> routes = validateRouteClasses(classSet.stream());
RouteRegistry.getInstance(servletContext).setNavigationTargets(routes);
} catch (InvalidRouteConfigurationException irce) {
throw new ServletException("Exception while registering Routes on servlet startup", irce);
}
}
use of com.vaadin.flow.server.InvalidRouteConfigurationException in project flow by vaadin.
the class RouterTest method verify_collisions_not_allowed_with_naming_convention.
@Test
public void verify_collisions_not_allowed_with_naming_convention() {
InvalidRouteConfigurationException exception = null;
try {
setNavigationTargets(NamingConvention.class, NamingConventionView.class);
} catch (InvalidRouteConfigurationException e) {
exception = e;
}
Assert.assertNotNull("Routes with same navigation target should not be allowed", exception);
}
use of com.vaadin.flow.server.InvalidRouteConfigurationException in project flow by vaadin.
the class RouteRegistryInitializerTest method routeFilter_ignoresErrorTargets.
@Test
public void routeFilter_ignoresErrorTargets() throws InvalidRouteConfigurationException {
registry.setErrorNavigationTargets(Stream.of(IgnoredErrorView.class, FileNotFound.class).collect(Collectors.toSet()));
Assert.assertTrue(registry.getErrorNavigationTarget(new NotFoundException()).isPresent());
ErrorTargetEntry errorTargetEntry = registry.getErrorNavigationTarget(new Exception()).get();
Assert.assertNotEquals(IgnoredErrorView.class, errorTargetEntry.getNavigationTarget());
}
Aggregations