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