邮递员中仅显示响应实体
only Response entity shown in Postman
我有一个生成 @Produces(MediaType.APPLICATION_JSON)
的响应,如下所示:
return Response.status(200).entity(product).entity("some message").build();
为什么邮递员在 json 视图结果中显示 unexpected s
并在 xml 视图
中显示 some message
对于Response.ResponseBuilder.entity(Object)`你可以看到
public abstract Response.ResponseBuilder entity(Object entity)
Set the response entity in the builder.
Any Java type instance for a response entity, that is supported by the runtime can be passed. It is the callers responsibility to wrap the actual entity with GenericEntity if preservation of its generic type is required. Note that the entity can be also set as an input stream.
A specific entity media type can be set using one of the type(...) methods.
由于您两次调用此方法,因此只保存最后一个值。
由于 "some message" 根本不是 JSON 语法,它表示 s(来自某些)是意外的,它期待 {
我有一个生成 @Produces(MediaType.APPLICATION_JSON)
的响应,如下所示:
return Response.status(200).entity(product).entity("some message").build();
为什么邮递员在 json 视图结果中显示 unexpected s
并在 xml 视图
some message
对于Response.ResponseBuilder.entity(Object)`你可以看到
public abstract Response.ResponseBuilder entity(Object entity)
Set the response entity in the builder. Any Java type instance for a response entity, that is supported by the runtime can be passed. It is the callers responsibility to wrap the actual entity with GenericEntity if preservation of its generic type is required. Note that the entity can be also set as an input stream.
A specific entity media type can be set using one of the type(...) methods.
由于您两次调用此方法,因此只保存最后一个值。
由于 "some message" 根本不是 JSON 语法,它表示 s(来自某些)是意外的,它期待 {