Vert.x includes an HttpClient and associated code for interacting with HTTP protocols, obviously this can be used to write client applications or in situations where we might use a reference from service discovery.
This is a very short post which is just mean’t to demonstrate the client capability which will be used in the next post (Service discovery with Vert.x).
HttpClient client = vertx.createHttpClient(); client.getNow(8080, "localhost", "/hello", response -> { response.bodyHandler( body -> System.out.println(body.toString())); });
The HttpClient gives us get, post, head etc. the Now postfixed named methods tend to be simpler syntax including the supply of callback and are composable using fluent style syntax.
See also Creating an HTTP client for more information.