gpt4 book ai didi

java - 客户端中的 Jersey 响应正文为空

转载 作者:行者123 更新时间:2023-12-01 09:27:46 25 4
gpt4 key购买 nike

我有一个服务器,我添加了一个与现有服务具有相同逻辑的服务。所以我有这个代码:

    @RolesAllowed({"authenticated", "administrator"})
@Path("notifications/{uuid}")
@Produces("application/json")
@GET
public Response getNotifications(@Context SecurityContext sc, @PathParam("uuid") String uuid) {
UserPrincipal requestingUser = (UserPrincipal) sc.getUserPrincipal();
CountNotiListItem notifications = customerService.getNotifications(requestingUser, uuid);
return Response.ok().entity(notifications).build();
}

通知对象不为空。响应已创建,并且具有与其他服务中相同的格式,但在客户端,我有 200 OK 响应,其中包含空“_body”[_body: {}] 为什么它为空?我应该修改更多内容才能填充 _body 吗?

最佳答案

您是否有一个测试用例,尝试将 CountNotiListItem 与 JSON 进行序列化和反序列化?如果 notifications 实际上非空,它会出现在该测试中吗?这将是我调试这个的开始。

关于java - 客户端中的 Jersey 响应正文为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39704728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com