如何使用WSClient分页api

时间:2018-12-26 21:43:17

标签: java playframework completable-future

我具有使用api生成用户列表的功能,当我尝试在用户页面之间进行分页时遇到很多问题。

private  CompletionStage<User[]> handelUserResult(WSResponse response) {
    User[]  pageUsers = Json.fromJson(response.asJson().get("values"),User[].class);
    if(response.asJson().get("next") == null){
        return CompletableFuture.completedFuture(pageUsers);
    }else{
          String nextPageUrl = response.asJson().get("next").asText();
          //get next coming pages

    }
}

如何使用handelUserResult从所有页面返回所有用户?

0 个答案:

没有答案