public Result index() {
WSRequest request = ws.url("http://localhost/fu.php");
CompletionStage<Result> responsePromise = request.get() .thenApply(response -> ok("RESULT " + response));
System.out.println(responsePromise);
try { Thread.sleep(2000); } catch(InterruptedException ex) { Thread.currentThread().interrupt(); } System.out.println(responsePromise);
return responsePromise;}
java.util.concurrent.CompletableFuture@70becf94[Not completed]java.util.concurrent.CompletableFuture@70becf94[Completed normally]java.util.concurrent.CompletionStage<play.mvc.Result> cannot be converted to play.mvc.Result
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/e0646a6f-f220-4032-9e57-308e80c7b2bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
If you return the CompletionStage directly from your action method, Play will send your response when it's available, without blocking.
RESULT play.libs.ws.ahc.AhcWSResponse@4c59194 public Result index() {/* ... */ }public CompletionStage<Result> index() { /* ... */ }If you return the CompletionStage directly from your action method, Play will send your response when it's available, without blocking.This is the part that I don't really understand, looking at output that Completed normally
I can actually use the actual result from the url call (in this case it return a string), right?and when action is complete in browser printed like this.RESULT play.libs.ws.ahc.AhcWSResponse@4c59194Not the actual string that I should get.