private <T> T request(final String method, final Class<T> clazz, final WebTarget resource, final Invocation.Builder request) throws DockerException, InterruptedException { try { return headers(request).async().method(method, clazz).get(); } catch (ExecutionException | MultiException e) { throw propagate(method, resource, e); } }
private <T> T request(final String method, final GenericType<T> type, final WebTarget resource, final Invocation.Builder request) throws DockerException, InterruptedException { try { return headers(request).async().method(method, type).get(); } catch (ExecutionException | MultiException e) { throw propagate(method, resource, e); } }
private <T> T request(final String method, final Class<T> clazz, final WebTarget resource, final Invocation.Builder request, final Entity<?> entity) throws DockerException, InterruptedException { try { return headers(request).async().method(method, entity, clazz).get(); } catch (ExecutionException | MultiException e) { throw propagate(method, resource, e); } }
private void request(final String method, final WebTarget resource, final Invocation.Builder request) throws DockerException, InterruptedException { try { headers(request).async().method(method, String.class).get(); } catch (ExecutionException | MultiException e) { throw propagate(method, resource, e); } }
@Override public <T> Future<T> submit(InvocationCallback<T> callback) { return invBuilder.async().method(httpMethod, entity, callback); } }
@Override public <T> Future<T> submit(InvocationCallback<T> callback) { return invBuilder.async().method(httpMethod, entity, callback); } }
@Override public Future<Response> submit() { return invBuilder.async().method(httpMethod, entity); }
@Override public <T> Future<T> submit(Class<T> cls) { return invBuilder.async().method(httpMethod, entity, cls); }
@Override public CompletableFuture<Response> method(String name) { CompletableFutureCallbackAdapter adapter = new CompletableFutureCallbackAdapter(); asyncInvoker.method(name, adapter); return adapter.getCompletableFuture(); }
@Override public <T> CompletableFuture<T> method(String name, Class<T> responseType) { CompletableFutureObjectCallbackAdapter<T> adapter = new CompletableFutureObjectCallbackAdapter<>(responseType); asyncInvoker.method(name, adapter); return adapter.getCompletableFuture(); }
@Override public <T> Flux<T> flux(String name, Entity<?> entity, Class<T> responseType) { Future<Response> futureResponse = webClient.async().method(name, entity); return Flux.fromIterable(toIterable(futureResponse, responseType)); }
@Override public <T> Flux<T> flux(String name, Class<T> responseType) { Future<Response> futureResponse = webClient.async().method(name); return Flux.fromIterable(toIterable(futureResponse, responseType)); }
@Test public void testRetrieveBookCustomMethodAsync() throws Exception { String address = "http://localhost:" + PORT + "/bookstore/retrieve"; WebClient wc = WebClient.create(address); wc.accept("application/xml"); Future<Book> book = wc.async().method("RETRIEVE", Entity.xml(new Book("Retrieve", 123L)), Book.class); assertEquals("Retrieve", book.get().getName()); wc.close(); }