How to get a status code?
I'm a bit new to JAX-RS.
I have the following code:
Client client = ClientBuilder.newClient();
WebTarget resource = client.target("/foo/bar/" + id);
final String xml = resource.request(MediaType.APPLICATION_XML).get(String.class);
This is a stupid question, but how exactly could I get the response and it's status code from here? The output is a String
...
Invocation.Builder builder = resource.request(MediaType.APPLICATION_XML);
Response resp = builder.get ();
int status = resp.getStatus ();
String xml = resp.getEntity (String.class);
链接地址: http://www.djcxy.com/p/45588.html
上一篇: jetty websocket服务器:根据应用程序逻辑发送客户状态码
下一篇: 如何获得状态码?