Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vert.x

vertx3

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!

like image 578
Gideon Avatar asked Jan 26 '26 18:01

Gideon


1 Answers

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.

like image 137
cy3er Avatar answered Jan 29 '26 05:01

cy3er



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!