io.vertx.reactivex.core.http.HttpClient Java Examples
The following examples show how to use
io.vertx.reactivex.core.http.HttpClient.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RxWebTestBase.java From graviteeio-access-management with Apache License 2.0 | 5 votes |
protected void testRequestBuffer(HttpClient client, HttpMethod method, int port, String path, Consumer<HttpClientRequest> requestAction, Consumer<HttpClientResponse> responseAction, int statusCode, String statusMessage, Buffer responseBodyBuffer, boolean normalizeLineEndings) throws Exception { CountDownLatch latch = new CountDownLatch(1); HttpClientRequest req = client.request(method, port, "localhost", path, resp -> { assertEquals(statusCode, resp.statusCode()); assertEquals(statusMessage, resp.statusMessage()); if (responseAction != null) { responseAction.accept(resp); } if (responseBodyBuffer == null) { latch.countDown(); } else { resp.bodyHandler(buff -> { if (normalizeLineEndings) { buff = normalizeLineEndingsFor(buff); } assertEquals(responseBodyBuffer, buff); latch.countDown(); }); } }); if (requestAction != null) { requestAction.accept(req); } req.end(); awaitLatch(latch); }
Example #2
Source File: MetaWeatherClient.java From tutorials with MIT License | 5 votes |
static Flowable<HttpClientResponse> searchByCityName(HttpClient httpClient, String cityName) { HttpClientRequest req = httpClient.get( new RequestOptions() .setHost("www.metaweather.com") .setPort(443) .setSsl(true) .setURI(format("/api/location/search/?query=%s", cityName))); return req .toFlowable() .doOnSubscribe(subscription -> req.end()); }
Example #3
Source File: RxWebTestBase.java From graviteeio-access-management with Apache License 2.0 | 4 votes |
protected void testRequestBuffer(HttpClient client, HttpMethod method, int port, String path, Consumer<HttpClientRequest> requestAction, Consumer<HttpClientResponse> responseAction, int statusCode, String statusMessage, Buffer responseBodyBuffer) throws Exception { testRequestBuffer(client, method, port, path, requestAction, responseAction, statusCode, statusMessage, responseBodyBuffer, false); }
Example #4
Source File: MetaWeatherClient.java From tutorials with MIT License | 4 votes |
/** * @return A flowable backed by vertx that automatically sends an HTTP request at soon as the first subscription is received. */ private static Flowable<HttpClientResponse> autoPerformingReq(HttpClient httpClient, String uri) { HttpClientRequest req = httpClient.get(new RequestOptions(metawether).setURI(uri)); return req.toFlowable() .doOnSubscribe(subscription -> req.end()); }
Example #5
Source File: MetaWeatherClient.java From tutorials with MIT License | 4 votes |
static Flowable<HttpClientResponse> getDataByPlaceId(HttpClient httpClient, long placeId) { return autoPerformingReq( httpClient, format("/api/location/%s/", placeId)); }