January 2018
Intermediate to advanced
348 pages
8h 17m
English
While synchronous and asynchronous calling was already supported in the Client API, now a new reactive style has been introduced with JAXRS 2.1. The Client API leverages the Java 8 CompletableFuture class (which implements CompletionStage<T>) and existing JAXRS 2.0 API to provide a reactive programming style:
Client client = ClientBuilder.newClient();WebTarget base = client.target("http://ex.org/resources/planets");CompletionStage<User> cs = base.request("application/json") .rx().get(String.class);cs.thenAccept(System.out::println);
The main difference is the addition of the rx() method call, which switches from the sync/async approach to a reactive one. This provides for greater flexibility in the computation of asynchronous ...
Read now
Unlock full access