Apache cxf webclient使用列表列表

时间:2017-01-12 21:54:23

标签: java jax-rs cxf

这是其他服务,它会发送一个文件列表列表:

@GET
@Path("duplicates")
@Secured
@Produces(MediaType.APPLICATION_JSON)
public List<List<File>> getDuplicates(@QueryParam("distance") int distance)

这是客户端代码,实际上它只能用于文件集合,但我如何设法获取文件列表列表?

public Collection<? extends File> getDuplicates(String token, int distance) {
    WebClient client = WebClient.create(UserClientService.URL).accept(MediaType.APPLICATION_JSON).
            type(MediaType.APPLICATION_JSON).path("duplicates").query("distance", distance).header(HttpHeaders.AUTHORIZATION, "Bearer " + token);
    return client.getCollection(File.class);
}

1 个答案:

答案 0 :(得分:0)

想出来:

client.get(new GenericType<List<List<File>>>(){});