@RunWith(DefaultServer.class)
public class RoutingHandlerTestCase {
@BeforeClass
public static void setup() {
RoutingHandler commonHandler = Handlers.routing()
.add(Methods.GET, "/baz", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("baz");
}
})
.add(Methods.GET, "/baz/{foo}", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("baz-path" + exchange.getQueryParameters().get("foo"));
}
});
RoutingHandler convienceHandler = Handlers.routing()
.get("/bar", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send("GET bar");
}