@Test public void testAddRoute() throws Exception { Route route = Route.GET("/.*", emptyHandler); router.addRoute(route); assertEquals(1, router.getRoutes().size()); assertEquals(1, router.getRoutes(HttpConstants.Method.GET).size()); }
@Override public void addRoute(Route route) { log.debug("Add route for {} '{}'", route.getRequestMethod(), route.getUriPattern()); validateRoute(route); routes.add(route); List<Route> cacheEntry = routesCache.get(route.getRequestMethod()); if (cacheEntry == null) { cacheEntry = new ArrayList<>(); } cacheEntry.add(route); routesCache.put(route.getRequestMethod(), cacheEntry); }
DefaultRouter implements Router { @Override public void addRoute(Route route) { log.debug("Add route for {} '{}'", route.getRequestMethod(), route.getUriPattern()); validateRoute(route); routes.add(route); List<Route> cacheEntry = routesCache.get(route.getRequestMethod()); if (cacheEntry == null) { cacheEntry = new ArrayList<>(); } cacheEntry.add(route); routesCache.put(route.getRequestMethod(), cacheEntry); } }
DefaultRouter implements Router { @Override public void addRoute(Route route) { log.debug("Add route for {} '{}'", route.getRequestMethod(), route.getUriPattern()); validateRoute(route); routes.add(route); List<Route> cacheEntry = routesCache.get(route.getRequestMethod()); if (cacheEntry == null) { cacheEntry = new ArrayList<>(); } cacheEntry.add(route); routesCache.put(route.getRequestMethod(), cacheEntry); } DefaultRouter(); }
DefaultRouter implements Router { @Override public void addRoute(Route route) { log.debug("Add route for {} '{}'", route.getRequestMethod(), route.getUriPattern()); validateRoute(route); routes.add(route); List<Route> cacheEntry = routesCache.get(route.getRequestMethod()); if (cacheEntry == null) { cacheEntry = new ArrayList<>(); } cacheEntry.add(route); routesCache.put(route.getRequestMethod(), cacheEntry); } DefaultRouter(); @Override String getContextPath(); @Override void setContextPath(String contextPath); @Override Set<String> getIgnorePaths(); @Override void ignorePaths(String... pathPrefixes); @Override final List<Route> getRoutes(); @Override void compileRoutes(); List<Route> getRoutes(String requestMethod); @Override List<RouteMatch> findRoutes(String requestMethod, String requestUri); @Override void addRoute(Route route); @Override void removeRoute(Route route); @Override void addRouteGroup(RouteGroup routeGroup); @Override void removeRouteGroup(RouteGroup routeGroup); @Override String uriFor(String relativeUri); @Override String uriFor(String nameOrUriPattern, Map<String, Object> parameters); @Override String uriPatternFor(Class<? extends ResourceHandler> resourceHandlerClass); @Override String getApplicationPath(); @Override void setApplicationPath(String applicationPath); @Override void addRouteTransformer(RouteTransformer transformer); @Override List<RouteTransformer> getRouteTransformers(); }
DefaultRouter implements Router { @Override public void addRoute(Route route) { log.debug("Add route for {} '{}'", route.getRequestMethod(), route.getUriPattern()); validateRoute(route); routes.add(route); List<Route> cacheEntry = routesCache.get(route.getRequestMethod()); if (cacheEntry == null) { cacheEntry = new ArrayList<>(); } cacheEntry.add(route); routesCache.put(route.getRequestMethod(), cacheEntry); } DefaultRouter(); @Override String getContextPath(); @Override void setContextPath(String contextPath); @Override Set<String> getIgnorePaths(); @Override void ignorePaths(String... pathPrefixes); @Override final List<Route> getRoutes(); @Override void compileRoutes(); List<Route> getRoutes(String requestMethod); @Override List<RouteMatch> findRoutes(String requestMethod, String requestUri); @Override void addRoute(Route route); @Override void removeRoute(Route route); @Override void addRouteGroup(RouteGroup routeGroup); @Override void removeRouteGroup(RouteGroup routeGroup); @Override String uriFor(String relativeUri); @Override String uriFor(String nameOrUriPattern, Map<String, Object> parameters); @Override String uriPatternFor(Class<? extends ResourceHandler> resourceHandlerClass); @Override String getApplicationPath(); @Override void setApplicationPath(String applicationPath); @Override void addRouteTransformer(RouteTransformer transformer); @Override List<RouteTransformer> getRouteTransformers();  }