'Java8 CompletionStage content
How do I actually get the content of this:
RxClient<RxCompletionStageInvoker> newRxClient = RxCompletionStage.newClient();
CompletionStage<Response> stage = newRxClient
.target("somelink")
.request()
.rx()
.get()
.toCompletableFuture();
Instead of:
java.util.concurrent.CompletableFuture@5ba3f27a[Completed normally]
Solution 1:[1]
I guese you called:
System.out.println(stage);
Which calls stage.toString() which prints the (CompatibleFuture) object, but not its content. To get the content of a Future object you simply use stage.get(). So the following should give you a representation of the Response object (and the json String if that is returned by Response#toString())
System.out.println(stage.get());
I hope this is what you were looking for
Solution 2:[2]
Calling toCompletableFuture() and then get() works:
stage.toCompletableFuture().get()
as per OP @Rauno's prior edit to the question.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | n247s |
| Solution 2 | vinzee |
