Gideon
Gideon

Reputation: 2251

How to send a full URL HTTP request in Vertx.io

I'm using vertx.io to make several HTTP requests, the input to the program is a file containing several full URLs. Checking the vertx.io HttpClient it seems like it can only query hosts but not full URLs. For example: it will successfully query http://www.yahoo.com/ but will fail on something like: http://finance.yahoo.com/news/us-stocks-slip-wal-mart-154834426.html

And so my questions are:

  1. Is it possible to query the full URL using the Vertx.io native HttpClient?
  2. Is it possible to use other HttpClients with vertx? For example use Apache asynchronous HTTP client with callbacks and vertx?

Googling these didn't find any good answers...

Thanks in advance!

Upvotes: 3

Views: 3978

Answers (1)

cy3er
cy3er

Reputation: 1699

1: You can use the getAbs method:

client.getAbs("http://finance.yahoo.com/news/us-stocks-slip-wal-mart-154834426.html", response -> {
  System.out.println("Received response with status code " + response.statusCode());
}).end();

Vertx HttpClient documentation

2: If you use it with the FutureCallback<HttpResponse> callback parameter then it won't block the event loop.

Upvotes: 6

Related Questions