Jersey Client DELETE 在第二次调用时挂起
Jersey Client DELETE hangs on second call
使用 Apache 连接器提供程序使用 Jersey Client 调用 Rest 服务。
我的 POST、GET 和 DELETE 调用成功。但是,在调用 Account DELETE 之后,所有后续调用都挂起。
这是我的代码。在以下情况下,第二个 DELETE 调用挂起。关于我可能做错的任何方向都会有所帮助..?
ClientConfig clientConfig = new ClientConfig();
clientConfig.connectorProvider(new ApacheConnectorProvider());
Cleint client = ClientBuilder.newClient(clientConfig);
Response response = client.target("https://hostname/rest")
.path("account")
.path(accountId)
.request(MediaType.APPLICATION_JSON_TYPE)
.delete();
response = client.target("https://hostname/rest")
.path("account")
.path(accountId)
.path("user").path(userId)
.request(MediaType.APPLICATION_JSON_TYPE)
.delete();
调用后需要关闭响应。
Response response = client.target("https://hostname/rest")
.path("account")
.path(accountId)
.request(MediaType.APPLICATION_JSON_TYPE)
.delete();
response.close();
response = client.target("https://hostname/rest")
.path("account")
.path(accountId)
.path("user").path(userId)
.request(MediaType.APPLICATION_JSON_TYPE)
.delete();
使用 Apache 连接器提供程序使用 Jersey Client 调用 Rest 服务。 我的 POST、GET 和 DELETE 调用成功。但是,在调用 Account DELETE 之后,所有后续调用都挂起。
这是我的代码。在以下情况下,第二个 DELETE 调用挂起。关于我可能做错的任何方向都会有所帮助..?
ClientConfig clientConfig = new ClientConfig();
clientConfig.connectorProvider(new ApacheConnectorProvider());
Cleint client = ClientBuilder.newClient(clientConfig);
Response response = client.target("https://hostname/rest")
.path("account")
.path(accountId)
.request(MediaType.APPLICATION_JSON_TYPE)
.delete();
response = client.target("https://hostname/rest")
.path("account")
.path(accountId)
.path("user").path(userId)
.request(MediaType.APPLICATION_JSON_TYPE)
.delete();
调用后需要关闭响应。
Response response = client.target("https://hostname/rest")
.path("account")
.path(accountId)
.request(MediaType.APPLICATION_JSON_TYPE)
.delete();
response.close();
response = client.target("https://hostname/rest")
.path("account")
.path(accountId)
.path("user").path(userId)
.request(MediaType.APPLICATION_JSON_TYPE)
.delete();