0

在我的代码中,我可以看到我正在返回一个有效的对象。该对象恰好包含“用户评论”的集合。在我通过 JAX-RS 返回 Response 对象之前,此集合是有效的并填充了条目。但是,当 GET 请求完成时,该集合神秘地被一个布尔值替换,表示该集合是否为空。

只是重申一下。有效的非空集合,在 GET 请求中作为布尔值返回,字段为“空”

是什么赋予了?我知道引擎盖下一定有一些魔法,但它一直在逃避我。

@GET
@Path("{issue: \\w+-\\d+}")
@Produces(MediaType.APPLICATION_JSON)
public Response getIssue(@PathParam("issue") String issue) {
    Issue returnedIssue = null;
    try {
        returnedIssue = jiraService.getIssue(issue);
    }
    catch (RestClientException ex) {
        log.error("ERROR: Could not find issue " + issue + ": " + ex.getMessage());
        throwErrorResponse(Response.Status.NOT_FOUND);
    }

    return getResponse(Response.Status.OK, returnedIssue);
}

这是我的 POJO:http ://docs.atlassian.com/jira-rest-java-client/1.0/apidocs/com/atlassian/jira/rest/client/domain/Issue.html

4

0 回答 0