How do I get a CompletableFuture from an Async Http Client request?

前端 未结 1 1767
野趣味
野趣味 2021-02-04 13:08

On Async Http Client documentation I see how to get a Future as the result of an asynchronous HTTP Get request simply doing, for example:



        
相关标签:
1条回答
  • 2021-02-04 13:29

    With AHC2:

    CompletableFuture<Response> f = asyncHttpClient
         .prepareGet("http://api.football-data.org/v1/soccerseasons/398")
         .execute()
         .toCompletableFuture();
    
    0 讨论(0)
提交回复
热议问题