From bb99db4963373742f67db1f70db15ee976bee791 Mon Sep 17 00:00:00 2001 From: "alessandro.gherardi" Date: Mon, 8 Jan 2018 11:17:01 -0700 Subject: [PATCH] Properly close the Apache response so that connections can be reused --- .../apache/connector/ApacheConnector.java | 23 ++++------ .../apache/connector/StreamingTest.java | 43 ++++++++++++++++++- 2 files changed, 49 insertions(+), 17 deletions(-) diff --git a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java index 4cfe1c8b4f..a4ebf8d712 100644 --- a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java +++ b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java @@ -486,7 +486,7 @@ public ClientResponse apply(final ClientRequest clientRequest) throws Processing } try { - responseContext.setEntityStream(new HttpClientResponseInputStream(getInputStream(response))); + responseContext.setEntityStream(getInputStream(response)); } catch (final IOException e) { LOGGER.log(Level.SEVERE, null, e); } @@ -625,18 +625,6 @@ private static Map writeOutBoundHeaders(final MultivaluedMap get() { return output; } + + @GET + @Path("get") + @Produces(MediaType.TEXT_PLAIN) + public String getString() { + return "OK"; + } } }