In vert.x web studying the root, I came across this code:
HttpServer server = Vertx.vertx().createHttpServer(); Router router = Router.router(Vertx.vertx()); Route route1 = router.route("/some/path/").handler(routingContext -> { HttpServerResponse response = routingContext.response(); response.setChunked(true); response.write("route1\n"); routingContext.vertx().setTimer(5000, tid -> routingContext.next()); }); Route route2 = router.route("/some/path/").handler(routingContext -> { HttpServerResponse response = routingContext.response(); response.write("route2\n"); routingContext.vertx().setTimer(5000, tid -> routingContext.next()); }); Route route3 = router.route("/some/path/").handler(routingContext -> { HttpServerResponse response = routingContext.response(); response.write("route3"); routingContext.response().end(); }); server.requestHandler(router::accept).listen(8080, new Handler<AsyncResult<HttpServer>>() { @Override public void handle(AsyncResult<HttpServer> event) { if(event.succeeded()) System.out.println("server started"); else System.out.println("server error"); } }); I can not understand what the route ("/ some / path /") method is responsible for. The method description says:
Route route(String path); Add a route that matches the specified HTTP method and path regex @param method the HTTP method to match @param regex URI paths that begin with a match for this regex will match @return the route The method accepts a string (I do not understand what this string is, what is written in it). Returns an instance of the Route interface. Got into it:
public interface Route { Add an HTTP method for this route. By default a route will match all HTTP methods. If any are specified then the route will only match any of the specified methods @param method the HTTP method to add @return a reference to this, so the API can be used fluently It is not clear from this alas