You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ve...@apache.org on 2013/11/24 10:58:13 UTC

svn commit: r1544951 - in /synapse/trunk/java: modules/integration/src/test/java/org/apache/synapse/samples/framework/clients/BasicHttpClient.java pom.xml

Author: veithen
Date: Sun Nov 24 09:58:13 2013
New Revision: 1544951

URL: http://svn.apache.org/r1544951
Log:
Upgraded to the latest httpclient version.

Modified:
    synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/clients/BasicHttpClient.java
    synapse/trunk/java/pom.xml

Modified: synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/clients/BasicHttpClient.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/clients/BasicHttpClient.java?rev=1544951&r1=1544950&r2=1544951&view=diff
==============================================================================
--- synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/clients/BasicHttpClient.java (original)
+++ synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/clients/BasicHttpClient.java Sun Nov 24 09:58:13 2013
@@ -19,11 +19,11 @@
 
 package org.apache.synapse.samples.framework.clients;
 
-import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.entity.BasicHttpEntity;
-import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
 
 import java.io.ByteArrayInputStream;
 import java.util.Map;
@@ -42,12 +42,12 @@ public class BasicHttpClient {
      * @throws Exception If an error occurs while making the HTTP call
      */
     public HttpResponse doGet(String url) throws Exception {
-        HttpClient client = new DefaultHttpClient();
+        CloseableHttpClient client = HttpClientBuilder.create().build();
         try {
             HttpGet get = new HttpGet(url);
             return new HttpResponse(client.execute(get));
         } finally {
-            client.getConnectionManager().shutdown();
+            client.close();
         }
     }
 
@@ -76,7 +76,7 @@ public class BasicHttpClient {
      */
     public HttpResponse doPost(String url, byte[] payload,
                                String contentType, Map<String,String> headers) throws Exception {
-        HttpClient client = new DefaultHttpClient();
+        CloseableHttpClient client = HttpClientBuilder.create().build();
         try {
             HttpPost post = new HttpPost(url);
             if (headers != null) {
@@ -90,7 +90,7 @@ public class BasicHttpClient {
             post.setEntity(entity);
             return new HttpResponse(client.execute(post));
         } finally {
-            client.getConnectionManager().shutdown();
+            client.close();
         }
     }
 

Modified: synapse/trunk/java/pom.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/pom.xml?rev=1544951&r1=1544950&r2=1544951&view=diff
==============================================================================
--- synapse/trunk/java/pom.xml (original)
+++ synapse/trunk/java/pom.xml Sun Nov 24 09:58:13 2013
@@ -1102,7 +1102,7 @@
         <jsch.version>0.1.31</jsch.version>
         <jms-1.1-spec.version>1.1</jms-1.1-spec.version>
         <httpcore.nio.version>4.3</httpcore.nio.version>
-        <http.client.version>4.1</http.client.version>
+        <http.client.version>4.3.1</http.client.version>
         <aspectj.version>1.6.1</aspectj.version>
         <qfj.version>1.4.0</qfj.version>
         <wso2uri-template.version>1.0.0</wso2uri-template.version>