2016-04-01 6 views
1

Anruf Rest-Service mit Jersey-Client mit Apache-Connector-Anbieter. Meine POST-, GET- und DELETE-Aufrufe waren erfolgreich. Nach dem Aufruf von Account DELETE hängen jedoch alle nachfolgenden Anrufe.Jersey Client DELETE hängt beim zweiten Anruf

Hier ist mein Code. Im folgenden Fall hängt der zweite DELETE-Aufruf. Irgendeine Richtung auf, was ich möglicherweise falsch mache, hilft ..?

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(); 

Antwort

1

Sie müssen Ihre Antwort nach dem Aufruf schließen.

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(); 
+0

Vielen Dank, das hat geholfen. –

Verwandte Themen