Apache cxf webclient 使用列表列表
Apache cxf webclient work with list of lists
这是其余服务,它发送文件列表列表:
@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);
}
想通了:
client.get(new GenericType<List<List<File>>>(){});
这是其余服务,它发送文件列表列表:
@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);
}
想通了:
client.get(new GenericType<List<List<File>>>(){});