JAL-1596 set HTTP 1.1 in HttpClient
authorMungo Carstairs <gmungoc@gmail.com>
Sun, 14 Dec 2014 13:45:23 +0000 (13:45 +0000)
committerMungo Carstairs <gmungoc@gmail.com>
Sun, 14 Dec 2014 13:45:23 +0000 (13:45 +0000)
src/jalview/ws/HttpClientUtils.java

index 229fa4e..1bdf64f 100644 (file)
@@ -29,6 +29,7 @@ import java.util.List;
 
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
+import org.apache.http.HttpVersion;
 import org.apache.http.NameValuePair;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.HttpClient;
@@ -40,6 +41,9 @@ import org.apache.http.entity.mime.content.FileBody;
 import org.apache.http.entity.mime.content.InputStreamBody;
 import org.apache.http.entity.mime.content.StringBody;
 import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.params.HttpParams;
 
 /**
  * Helpful procedures for working with services via HTTPClient
@@ -64,7 +68,10 @@ public class HttpClientUtils
           List<NameValuePair> vals) throws ClientProtocolException,
           IOException
   {
-    HttpClient httpclient = new DefaultHttpClient();
+    HttpParams params = new BasicHttpParams();
+    params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION,
+            HttpVersion.HTTP_1_1);
+    HttpClient httpclient = new DefaultHttpClient(params);
     HttpPost httppost = new HttpPost(postUrl);
     UrlEncodedFormEntity ue = new UrlEncodedFormEntity(vals, "UTF-8");
     httppost.setEntity(ue);