【发布时间】:2016-09-15 06:36:12
【问题描述】:
我正在使用 restygwt 制作客户端-服务器应用程序。我已经编写了我的方法并制作了一个 servlet。
@GET
@Path("/get/getpoints/{projectId}")
@Produces(MediaType.APPLICATION_JSON)
void getAZPoints(@PathParam("projectId") BigInteger projectID,
MethodCallback <Map<String, String>> responseWithName);
当使用Map<String, String> 类型的响应时,我从客户端的服务器收到不正确的响应。 Servlet 返回数据如下:
["1":"New Pole","2":"New Manhole","3":"New Container 2","4":"New Building#11"]
但是当它收到时,我的回复只包含 2 个条目。
如果我将类型更改为List<String>
@GET
@Path("/get/getpoints/{projectId}")
@Produces(MediaType.APPLICATION_JSON)
void getAZPoints(@PathParam("projectId") BigInteger projectID,
MethodCallback <List<String>> responseWithName);
我的响应和servlet返回数据一样。
你能帮我解决这个问题吗?
【问题讨论】:
标签: java json rest servlets gwt