@Test public void testValidRoutePatterns() throws Exception { FullHttpRequest modifiedReq = testPattern("/metrics/:metricId", "/metrics/foo"); Assert.assertTrue(testRouteHandlerCalled); Assert.assertEquals(1, modifiedReq.headers().names().size()); Assert.assertEquals("metricId", modifiedReq.headers().entries().get(0).getKey()); Assert.assertEquals("foo", modifiedReq.headers().entries().get(0).getValue()); testRouteHandlerCalled = false; modifiedReq = testPattern("/tenants/:tenantId/entities/:entityId", "/tenants/acFoo/entities/enBar"); Assert.assertTrue(testRouteHandlerCalled); Assert.assertEquals(2, modifiedReq.headers().names().size()); Assert.assertTrue(modifiedReq.headers().get("tenantId").equals("acFoo")); Assert.assertTrue(modifiedReq.headers().get("entityId").equals("enBar")); testRouteHandlerCalled = false; modifiedReq = testPattern("/tenants/:tenantId/entities/:entityId/checks/:checkId/metrics/:metricId/plot", "/tenants/acFoo/entities/enBar/checks/chFoo/metrics/myMetric/plot"); Assert.assertTrue(testRouteHandlerCalled); Assert.assertEquals(4, modifiedReq.headers().names().size()); Assert.assertTrue(modifiedReq.headers().get("tenantId").equals("acFoo")); Assert.assertTrue(modifiedReq.headers().get("entityId").equals("enBar")); Assert.assertTrue(modifiedReq.headers().get("entityId").equals("enBar")); Assert.assertTrue(modifiedReq.headers().get("checkId").equals("chFoo")); Assert.assertTrue(modifiedReq.headers().get("metricId").equals("myMetric")); testRouteHandlerCalled = false; modifiedReq = testPattern("/software/:name/:version", "/software/blueflood/v0.1"); Assert.assertTrue(testRouteHandlerCalled); Assert.assertEquals(2, modifiedReq.headers().names().size()); Assert.assertTrue(modifiedReq.headers().get("name").equals("blueflood")); Assert.assertTrue(modifiedReq.headers().get("version").equals("v0.1")); testRouteHandlerCalled = false; modifiedReq = testPattern("/software/:name/:version/", "/software/blueflood/v0.1/"); Assert.assertTrue(testRouteHandlerCalled); Assert.assertEquals(2, modifiedReq.headers().names().size()); Assert.assertTrue(modifiedReq.headers().get("name").equals("blueflood")); Assert.assertTrue(modifiedReq.headers().get("version").equals("v0.1")); testRouteHandlerCalled = false; modifiedReq = testPattern("/:name/:version","/blueflood/v0.1"); Assert.assertTrue(testRouteHandlerCalled); Assert.assertEquals(2, modifiedReq.headers().names().size()); Assert.assertTrue(modifiedReq.headers().get("name").equals("blueflood")); Assert.assertTrue(modifiedReq.headers().get("version").equals("v0.1")); testRouteHandlerCalled = false; }
public void get(String pattern, HttpRequestHandler handler) { addBinding(pattern, HttpMethod.GET.name(), handler, getBindings); }
RouteMatcher { public void get(String pattern, HttpRequestHandler handler) { addBinding(pattern, HttpMethod.GET.name(), handler, getBindings); } }
RouteMatcher { public void get(String pattern, HttpRequestHandler handler) { addBinding(pattern, HttpMethod.GET.name(), handler, getBindings); } RouteMatcher(); }
RouteMatcher { public void get(String pattern, HttpRequestHandler handler) { addBinding(pattern, HttpMethod.GET.name(), handler, getBindings); } RouteMatcher(); RouteMatcher withNoRouteHandler(HttpRequestHandler noRouteHandler); void route(ChannelHandlerContext context, FullHttpRequest request); void get(String pattern, HttpRequestHandler handler); void put(String pattern, HttpRequestHandler handler); void post(String pattern, HttpRequestHandler handler); void delete(String pattern, HttpRequestHandler handler); void head(String pattern, HttpRequestHandler handler); void options(String pattern, HttpRequestHandler handler); void connect(String pattern, HttpRequestHandler handler); void patch(String pattern, HttpRequestHandler handler); Set<String> getSupportedMethodsForURL(String URL); }
RouteMatcher { public void get(String pattern, HttpRequestHandler handler) { addBinding(pattern, HttpMethod.GET.name(), handler, getBindings); } RouteMatcher(); RouteMatcher withNoRouteHandler(HttpRequestHandler noRouteHandler); void route(ChannelHandlerContext context, FullHttpRequest request); void get(String pattern, HttpRequestHandler handler); void put(String pattern, HttpRequestHandler handler); void post(String pattern, HttpRequestHandler handler); void delete(String pattern, HttpRequestHandler handler); void head(String pattern, HttpRequestHandler handler); void options(String pattern, HttpRequestHandler handler); void connect(String pattern, HttpRequestHandler handler); void patch(String pattern, HttpRequestHandler handler); Set<String> getSupportedMethodsForURL(String URL);  }