From d7c173ccfd20a4fe12b820d561af1ef871d51dd6 Mon Sep 17 00:00:00 2001 From: Daniel Unfried Date: Wed, 19 Nov 2014 15:28:47 +0100 Subject: [PATCH 1/3] Remove Request#setConnectionKeepAlive() --- src/main/java/org/scribe/model/Request.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/main/java/org/scribe/model/Request.java b/src/main/java/org/scribe/model/Request.java index e48578e21..950ded882 100644 --- a/src/main/java/org/scribe/model/Request.java +++ b/src/main/java/org/scribe/model/Request.java @@ -31,7 +31,6 @@ public class Request private HttpURLConnection connection; private String charset; private byte[] bytePayload = null; - private boolean connectionKeepAlive = false; private boolean followRedirects = true; private Long connectTimeout = null; private Long readTimeout = null; @@ -81,7 +80,6 @@ private void createConnection() throws IOException String completeUrl = getCompleteUrl(); if (connection == null) { - System.setProperty("http.keepAlive", connectionKeepAlive ? "true" : "false"); connection = (HttpURLConnection) new URL(completeUrl).openConnection(); connection.setInstanceFollowRedirects(followRedirects); } @@ -350,17 +348,6 @@ public void setCharset(String charsetName) this.charset = charsetName; } - /** - * Sets whether the underlying Http Connection is persistent or not. - * - * @see http://download.oracle.com/javase/1.5.0/docs/guide/net/http-keepalive.html - * @param connectionKeepAlive - */ - public void setConnectionKeepAlive(boolean connectionKeepAlive) - { - this.connectionKeepAlive = connectionKeepAlive; - } - /** * Sets whether the underlying Http Connection follows redirects or not. * From a79166fc29814c982c1845ff491d394429bc68d8 Mon Sep 17 00:00:00 2001 From: Daniel Unfried Date: Wed, 19 Nov 2014 17:39:07 +0100 Subject: [PATCH 2/3] Add deprecated Request#setConnectionKeepAlive() Add deprecated null-implementation to not break existing clients. --- src/main/java/org/scribe/model/Request.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/org/scribe/model/Request.java b/src/main/java/org/scribe/model/Request.java index 950ded882..1349f1c42 100644 --- a/src/main/java/org/scribe/model/Request.java +++ b/src/main/java/org/scribe/model/Request.java @@ -348,6 +348,20 @@ public void setCharset(String charsetName) this.charset = charsetName; } + /** + * Sets whether the underlying Http Connection is persistent or not. + * + * @deprecated since 1.3.7 - does nothing. Prior implementation did not just modify keep-alive for the underlying + * connection of this {@code Request}, but implicitly for all Http connections of the JVM instance. + * New default is not to modify JVM default behaviour and leave Http connection keep-alive enabled. + * + * @see http://download.oracle.com/javase/1.5.0/docs/guide/net/http-keepalive.html + * @param connectionKeepAlive + */ + @Deprecated + public void setConnectionKeepAlive(boolean connectionKeepAlive) + {} + /** * Sets whether the underlying Http Connection follows redirects or not. * From 7e15c2df8528d36d0262bda71571c02ae94b631c Mon Sep 17 00:00:00 2001 From: Daniel Unfried Date: Fri, 21 Nov 2014 09:47:54 +0100 Subject: [PATCH 3/3] Concise Javadoc for Request#setConnectionKeepAlive() --- src/main/java/org/scribe/model/Request.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/scribe/model/Request.java b/src/main/java/org/scribe/model/Request.java index 1349f1c42..322d5c99b 100644 --- a/src/main/java/org/scribe/model/Request.java +++ b/src/main/java/org/scribe/model/Request.java @@ -351,9 +351,8 @@ public void setCharset(String charsetName) /** * Sets whether the underlying Http Connection is persistent or not. * - * @deprecated since 1.3.7 - does nothing. Prior implementation did not just modify keep-alive for the underlying - * connection of this {@code Request}, but implicitly for all Http connections of the JVM instance. - * New default is not to modify JVM default behaviour and leave Http connection keep-alive enabled. + * @deprecated does nothing - JVM default is left untouched. + * Set {@code http.keepAlive} system property to {@code false} for pre-deprecation behavior. * * @see http://download.oracle.com/javase/1.5.0/docs/guide/net/http-keepalive.html * @param connectionKeepAlive