我正在使用jersey-client 1.8,用于我的REST Automation
每当我收到HTTP响应204(无内容)时,我都会收到以下异常:
例外:
com.sun.jersey.api.client.UniformInterfaceException: DELETE https://MYURL returned a response status of 204 No Content
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:528)
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:506).
获取回复的我的代码
case DELETE:
{
HEADER_AUTH = getAuthHeader(uname,pwd);
wResource = client.resource(URI);
response = wResource.accept(MediaType.APPLICATION_JSON).
header("Authorization", HEADER_AUTH).
type(MediaType.APPLICATION_JSON).
delete(ClientResponse.class, payload);
response_string = response.getEntity(String.class);
status = response.getStatus();
apiResponseString = new HashMap<>();
apiResponseString.put("response", response_string);
apiResponseString.put("status", ""+status);
break;
}