IllegalStateException within method with Response paramether

半腔热情 提交于 2019-11-30 18:02:39

There are two types of Responsees, inbound and outbound, though they still use the same interface. Outbound is when you are sending a response from the server

Response response = Response.ok(entity).build();

Inbound is when you are receiving the response on the client side.

Response response = webTarget.request().get();

The readEntity method is disabled on the server side outbound response, because you don't need it. It is only used when you need to _de_serialize the response from the response stream. But there is none when it's outbound.

If you want the entity on the outbound response, just use Response#getEntity()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!