0
不确定如何使此代码获得200响应。看起来请求/响应中有“无内容”/ 204。获取204通过POST使用json实体承担代码
private Response doPostRequestAsJSON(String url) {
ClientConfig clientConfig = new ClientConfig();
clientConfig.register(JacksonFeature.class);
Client client = ClientBuilder.newClient(clientConfig);
AuthLoginElement authLoginElement = new AuthLoginElement("user1", "pass1");
WebTarget webTarget = client.target(url);
Response response = webTarget.request("application/json")
.post(Entity.entity(authLoginElement, "application/json"));
return response;
}
是的。我想我是好的,只要它能正常工作/发送消息就可以与之共存:) – ses 2014-10-07 19:18:21