Example usage for io.vertx.core.http HttpClient getNow

List of usage examples for io.vertx.core.http HttpClient getNow

Introduction

In this page you can find the example usage for io.vertx.core.http HttpClient getNow.

Prototype

@Fluent
default HttpClient getNow(int port, String host, String requestURI,
        Handler<AsyncResult<HttpClientResponse>> responseHandler) 

Source Link

Document

Sends an HTTP GET request to the server at the specified host and port, specifying a response handler to receive the response

Usage

From source file:examples.HTTPExamples.java

License:Open Source License

public void example31(Vertx vertx) {
    HttpClient client = vertx.createHttpClient();

    // Specify both port and host name
    client.getNow(8080, "myserver.mycompany.com", "/some-uri", response -> {
        System.out.println("Received response with status code " + response.statusCode());
    });/*from  w w  w .ja  v a  2 s  . c  o m*/

    // This time use the default port 80 but specify the host name
    client.getNow("foo.othercompany.com", "/other-uri", response -> {
        System.out.println("Received response with status code " + response.statusCode());
    });
}