我正在尝试为 restful 资源编写一个 java 客户端。我的请求的响应是一个对象列表。我有以下请求代码。但是我得到了一些解码异常。谁能告诉我如何解决这个问题?
GenericType<List<Response>> genType = new GenericType<List<Response>>() {};
GenericType<List<Response>> response = (GenericType<List<Response>>)resource.path(paramPath).accept(MediaType.APPLICATION_JSON).get(genType);
我的资源有以下代码
@GET
@Path("/app/{Id}")
@Produces(MediaType.APPLICATION_JSON)
public List<Response> getAllKeyValuesByAppId(@PathParam("Id") Long Id){
...
...
}
最佳答案
你能在不解码的情况下测试你的 REST 方法吗? 您确定邮件正文包含您所期望的内容吗?
关于java restful 服务客户端接受响应列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11300755/