如何获得状态码?

我对JAX-RS有点新鲜。

我有以下代码:

Client client = ClientBuilder.newClient();

WebTarget resource = client.target("/foo/bar/" + id);

final String xml = resource.request(MediaType.APPLICATION_XML).get(String.class);

这是一个愚蠢的问题,但我究竟能从这里得到响应和状态码? 输出是一个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/45587.html

上一篇: How to get a status code?

下一篇: page> defined in web.xml always comes back with HTTP status 200