使用 restygwt 返回不正确的响应对象

incorrect response object returned using restygwt

我正在使用 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 return 数据如下:

["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 return 数据相同。

你能帮我解决这个问题吗?

我发现这是一个众所周知的问题 - https://github.com/resty-gwt/resty-gwt/issues/119。它发生是因为我的字符串(在我的示例中实际上是一个数字字符串,如“123”等)像数字一样发送并且以错误的方式解码。作为解决方案,我将我的大整数作为带有一些文本字符的字符串发送,并在客户端对其进行解码。现在可以正常使用了。