directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject [2/2] directory-fortress-core git commit: FC-122 - Use latest httpclient from apache httpcomponents
Date Sat, 31 Oct 2015 15:45:46 GMT
FC-122 - Use latest httpclient from apache httpcomponents


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/c4ec02a0
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/c4ec02a0
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/c4ec02a0

Branch: refs/heads/master
Commit: c4ec02a0afd9af1d4b3e6ec086e9a4261b0e7d76
Parents: ca53b1e
Author: Shawn McKinney <smckinney@apache.org>
Authored: Sat Oct 31 10:45:29 2015 -0500
Committer: Shawn McKinney <smckinney@apache.org>
Committed: Sat Oct 31 10:45:29 2015 -0500

----------------------------------------------------------------------
 build.xml                                       | 15 ++++---
 ivy.xml                                         |  9 ++--
 pom.xml                                         | 47 ++++++++++++--------
 .../directory/fortress/core/rest/RestUtils.java | 35 ++++++---------
 4 files changed, 57 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/c4ec02a0/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 8fdba44..07c5bfb 100644
--- a/build.xml
+++ b/build.xml
@@ -154,8 +154,11 @@
        <property name="commons-collections.jar" value="${lib.dir}/commons-collections-3.2.1.jar"/>
        <property name="commons-logging.jar" value="${lib.dir}/commons-logging-1.1.1.jar"/>
        <property name="commons-io.jar" value="${lib.dir}/commons-io-2.4.jar"/>
-       <property name="cxf-common-utilities.jar" value="${lib.dir}/cxf-common-utilities-2.5.11.jar"/>
-       <property name="commons-codec.jar" value="${lib.dir}/commons-codec-1.2.jar"/>
+       <property name="httpclient.jar" value="${lib.dir}/httpclient-4.5.1.jar"/>
+       <property name="httpcore.jar" value="${lib.dir}/httpcore-4.4.3.jar"/>
+       <property name="cxf-common-utilities.jar" value="${lib.dir}/cxf-api-2.7.17.jar"/>
+       <property name="javax.ws.rs-api.jar" value="${lib.dir}/javax.ws.rs-api-2.0.1.jar"/>
+       <property name="commons-codec.jar" value="${lib.dir}/commons-codec-1.10.jar"/>
        <property name="jgraph.jar" value="${lib.dir}/jgrapht-core-0.9.1.jar"/>
        <property name="log4j.jar" value="${lib.dir}/log4j-1.2.17.jar"/>
        <property name="junit.jar" value="${lib.dir}/junit-4.12.jar"/>
@@ -165,7 +168,6 @@
        <property name="jaxb-impl.jar" value="${lib.dir}/jaxb-impl-2.2.4-1.jar"/>
        <property name="jaxb-xjc.jar" value="${lib.dir}/jaxb-xjc-2.2.4-1.jar"/>
        <property name="jackson-jaxrs.jar" value="${lib.dir}/jackson-jaxrs-1.9.0.jar"/>
-       <property name="commons-httpclient.jar" value="${lib.dir}/commons-httpclient-3.1.jar"/>
        <property name="javaee-api.jar" value="${lib.dir}/javaee-api-7.0.jar"/>
        <property name="ehcache-core.jar" value="${lib.dir}/ehcache-core-2.6.10.jar"/>
        <property name="slf4j-api.jar" value="${lib.dir}/slf4j-api-1.7.12.jar"/>
@@ -186,12 +188,13 @@
            <pathelement location="${commons-config.jar}"/>
            <pathelement location="${commons-lang.jar}"/>
            <pathelement location="${commons-io.jar}"/>
+           <pathelement location="${httpclient.jar}"/>
+           <pathelement location="${httpcore.jar}"/>
            <pathelement location="${jasypt.jar}"/>
            <pathelement location="${jaxb-api.jar}"/>
            <pathelement location="${jaxb-impl.jar}"/>
            <pathelement location="${jaxb-xjc.jar}"/>
            <pathelement location="${jackson-jaxrs.jar}"/>
-           <pathelement location="${commons-httpclient.jar}"/>
            <pathelement location="${javaee-api.jar}"/>
            <pathelement location="${cxf-common-utilities.jar}"/>
            <pathelement location="${ehcache-core.jar}"/>
@@ -223,11 +226,13 @@
            <pathelement location="${commons-collections.jar}"/>
            <pathelement location="${commons-codec.jar}"/>
            <pathelement location="${commons-io.jar}"/>
+           <pathelement location="${httpclient.jar}"/>
+           <pathelement location="${httpcore.jar}"/>
            <pathelement location="${jasypt.jar}"/>
            <pathelement location="${jackson-jaxrs.jar}"/>
-           <pathelement location="${commons-httpclient.jar}"/>
            <pathelement location="${javaee-api.jar}"/>
            <pathelement location="${cxf-common-utilities.jar}"/>
+           <pathelement location="${javax.ws.rs-api.jar}"/>
            <pathelement location="${jaxb-api.jar}"/>
            <pathelement location="${jaxb-impl.jar}"/>
            <pathelement location="${jaxb-xjc.jar}"/>

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/c4ec02a0/ivy.xml
----------------------------------------------------------------------
diff --git a/ivy.xml b/ivy.xml
index a1ff094..3430e1b 100755
--- a/ivy.xml
+++ b/ivy.xml
@@ -30,7 +30,7 @@
         <dependency org="commons-lang" name="commons-lang" rev="2.6" conf="default->master"/>
         <dependency org="commons-collections" name="commons-collections" rev="3.2.1" conf="default->master"/>
         <dependency org="commons-logging" name="commons-logging" rev="1.1.1" conf="default->master"/>
-        <dependency org="commons-codec" name="commons-codec" rev="1.2" conf="default->master"/>
+        <dependency org="commons-codec" name="commons-codec" rev="1.10" conf="default->master"/>
         <dependency org="commons-io" name="commons-io" rev="2.4" conf="default->master"/>
         <dependency org="junit" name="junit" rev="4.12" conf="default->master"/>
         <dependency org="org.hamcrest" name="hamcrest-core" rev="1.3" conf="default->master"/>
@@ -40,11 +40,12 @@
         <dependency org="com.sun.xml.bind" name="jaxb-xjc" rev="2.2.4-1" conf="default->master"/>
         <dependency org="com.sun.xml.bind" name="jaxb-impl" rev="2.2.4-1" conf="default->master"/>
         <dependency org="javax.xml.bind" name="jaxb-api" rev="2.2.6" conf="default->master"/>
-        <dependency org="commons-httpclient" name="commons-httpclient" rev="3.1" conf="default->master"/>
+        <dependency org="org.apache.httpcomponents" name="httpclient" rev="4.5.1" conf="default->master"/>
+        <dependency org="org.apache.httpcomponents" name="httpcore" rev="4.4.3" conf="default->master"/>
         <dependency org="org.codehaus.jackson" name="jackson-jaxrs" rev="1.9.0" conf="default->master"/>
-<!--        <dependency org="javax.ws.rs" name="jsr311-api" rev="1.1.1" conf="default->master"
/>-->
         <dependency org="javax" name="javaee-api" rev="7.0" conf="default->master"/>
-        <dependency org="org.apache.cxf" name="cxf-common-utilities" rev="2.5.11" conf="default->master"/>
+        <dependency org="org.apache.cxf" name="cxf-api" rev="2.7.17" conf="default->master"/>
+        <dependency org="javax.ws.rs" name="javax.ws.rs-api" rev="2.0.1" conf="default->master"/>
         <dependency org="net.sf.ehcache" name="ehcache-core" rev="2.6.10" conf="default->master"/>
         <dependency org="org.slf4j" name="slf4j-api" rev="1.7.12" conf="default->master"/>
         <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.7.12" conf="default->master"/>

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/c4ec02a0/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 07e7419..2dd1669 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,17 +88,19 @@
     <version.api.all>1.0.0-M31</version.api.all>
     <version.commons.beanutils>1.7.0</version.commons.beanutils>
     <version.commons.beanutils-core>1.8.0</version.commons.beanutils-core>
-    <version.commons.codec>1.2</version.commons.codec>
+    <version.commons.codec>1.10</version.commons.codec>
     <version.commons.collections>3.2.1</version.commons.collections>
     <version.commons.configuration>1.10</version.commons.configuration>
     <version.commons.digester>1.8</version.commons.digester>
     <version.commons.httpclient>3.1</version.commons.httpclient>
     <version.httpcomponent.httpclient>4.5.1</version.httpcomponent.httpclient>
+    <version.httpcomponent.httpcore>4.4.3</version.httpcomponent.httpcore>
     <version.commons.io>2.4</version.commons.io>
     <version.commons.lang>2.6</version.commons.lang>
     <version.commons.logging>1.1.1</version.commons.logging>
     <version.commons.pool>1.6</version.commons.pool>
-    <version.cxf.common.utilities>2.5.11</version.cxf.common.utilities>
+    <version.cxf.common.utilities>2.7.17</version.cxf.common.utilities>
+    <version.javax.ws.rs-api>2.0.1</version.javax.ws.rs-api>
     <version.dom4j>1.6.1</version.dom4j>
     <version.ehcache.core>2.6.10</version.ehcache.core>
     <version.hamcrest.core>1.3</version.hamcrest.core>
@@ -120,7 +122,6 @@
     <version.xpp3>1.1.4c</version.xpp3>
     <version.xml.apis>1.0b2</version.xml.apis>
     <version.jaxb>2.2.4-1</version.jaxb>
-    <version.commons.codec>1.2</version.commons.codec>
 
     <!-- ===================================================== -->
     <!-- This is a hack to allow someone to release       -->
@@ -171,15 +172,15 @@
     </dependency>
 
     <dependency>
-      <groupId>commons-httpclient</groupId>
-      <artifactId>commons-httpclient</artifactId>
-      <version>${version.commons.httpclient}</version>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient</artifactId>
+      <version>${version.httpcomponent.httpclient}</version>
     </dependency>
 
     <dependency>
       <groupId>org.apache.httpcomponents</groupId>
-      <artifactId>httpclient</artifactId>
-      <version>${version.httpcomponent.httpclient}</version>
+      <artifactId>httpcore</artifactId>
+      <version>${version.httpcomponent.httpcore}</version>
     </dependency>
 
     <dependency>
@@ -196,11 +197,17 @@
 
     <dependency>
       <groupId>org.apache.cxf</groupId>
-      <artifactId>cxf-common-utilities</artifactId>
+      <artifactId>cxf-api</artifactId>
       <version>${version.cxf.common.utilities}</version>
     </dependency>
 
     <dependency>
+      <groupId>javax.ws.rs</groupId>
+      <artifactId>javax.ws.rs-api</artifactId>
+      <version>${version.javax.ws.rs-api}</version>
+    </dependency>
+
+    <dependency>
       <groupId>org.apache.directory.api</groupId>
       <artifactId>api-all</artifactId>
       <version>${version.api.all}</version>
@@ -662,9 +669,10 @@
                     <pathelement location="${org.slf4j:slf4j-api:jar}" />
                     <pathelement location="${org.slf4j:slf4j-log4j12:jar}" />
                     <pathelement location="${antlr:antlr:jar}" />
-                    <pathelement location="${org.apache.cxf:cxf-common-utilities:jar}"
/>
-                    <pathelement location="${javax.ws.rs:jsr311-api:jar}" />
-                    <pathelement location="${commons-httpclient:commons-httpclient:jar}"
/>
+                    <pathelement location="${org.apache.cxf:cxf-api:jar}" />
+                    <pathelement location="${javax.ws.rs:javax.ws.rs-api:jar}" />
+                    <pathelement location="${org.apache.httpcomponents:httpclient:jar}"
/>
+                    <pathelement location="${org.apache.httpcomponents:httpcore:jar}"
/>
                     <pathelement location="${com.sun.xml.bind:jaxb-impl:jar}" />
                     <pathelement location="${commons-codec:commons-codec:jar}" />
                   </classpath>
@@ -730,9 +738,11 @@
                         <pathelement location="${org.slf4j:slf4j-log4j12:jar}" />
                         <pathelement location="${antlr:antlr:jar}" />
                         <pathelement location="${junit:junit:jar}" />
-                        <pathelement location="${org.apache.cxf:cxf-common-utilities:jar}"
/>
-                        <pathelement location="${javax.ws.rs:jsr311-api:jar}" />
-                        <pathelement location="${commons-httpclient:commons-httpclient:jar}"
/>
+                        <pathelement location="${org.apache.cxf:cxf-api:jar}" />
+                        <pathelement location="${javax.ws.rs:javax.ws.rs-api:jar}" />
+                        <pathelement location="${javax.ws.rs:javax.ws.rs-api:jar}" />
+                        <pathelement location="${org.apache.httpcomponents:httpclient:jar}"
/>
+                          <pathelement location="${org.apache.httpcomponents:httpcore:jar}"
/>
                         <pathelement location="${com.sun.xml.bind:jaxb-impl:jar}" />
                         <pathelement location="${commons-codec:commons-codec:jar}" />
                       </classpath>
@@ -790,9 +800,10 @@
                         <pathelement location="${org.slf4j:slf4j-log4j12:jar}" />
                         <pathelement location="${antlr:antlr:jar}" />
                         <pathelement location="${junit:junit:jar}" />
-                        <pathelement location="${org.apache.cxf:cxf-common-utilities:jar}"
/>
-                        <pathelement location="${javax.ws.rs:jsr311-api:jar}" />
-                        <pathelement location="${commons-httpclient:commons-httpclient:jar}"
/>
+                        <pathelement location="${org.apache.cxf:cxf-api:jar}" />
+                        <pathelement location="${javax.ws.rs:javax.ws.rs-api:jar}" />
+                        <pathelement location="${org.apache.httpcomponents:httpclient:jar}"
/>
+                          <pathelement location="${org.apache.httpcomponents:httpcore:jar}"
/>
                         <pathelement location="${com.sun.xml.bind:jaxb-impl:jar}" />
                         <pathelement location="${commons-codec:commons-codec:jar}" />
                       </classpath>

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/c4ec02a0/src/main/java/org/apache/directory/fortress/core/rest/RestUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rest/RestUtils.java b/src/main/java/org/apache/directory/fortress/core/rest/RestUtils.java
index b0f41ff..3886f20 100644
--- a/src/main/java/org/apache/directory/fortress/core/rest/RestUtils.java
+++ b/src/main/java/org/apache/directory/fortress/core/rest/RestUtils.java
@@ -23,7 +23,6 @@ package org.apache.directory.fortress.core.rest;
 import java.io.IOException;
 import java.io.StringReader;
 import java.io.StringWriter;
-import java.nio.charset.Charset;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Properties;
@@ -35,15 +34,6 @@ import javax.xml.bind.JAXBException;
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
 
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.commons.httpclient.methods.RequestEntity;
-import org.apache.commons.httpclient.methods.StringRequestEntity;
-
-
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.directory.fortress.core.model.FortRequest;
@@ -243,17 +233,16 @@ public class RestUtils
     {
         LOG.debug( "post URI=[{}], function=[{}], request=[{}]", URI, function, szInput );
         String szResponse = null;
-//        PostMethod post = new PostMethod( URI + function );
         HttpPost post = new HttpPost(URI + function);
-        post.addHeader("Accept", "text/xml");
+        post.addHeader( "Accept", "text/xml" );
         setMethodHeaders( post );
         try
         {
             HttpEntity entity = new StringEntity( szInput, ContentType.TEXT_XML );
-            post.setEntity(entity);
+            post.setEntity( entity );
             org.apache.http.client.HttpClient httpclient = HttpClientBuilder.create()
                     .setDefaultCredentialsProvider(getCredentialProvider(userId, password)).build();
-            HttpResponse response = httpclient.execute(post);
+            HttpResponse response = httpclient.execute( post );
             String error;
 
             switch ( response.getStatusLine().getStatusCode() )
@@ -296,6 +285,14 @@ public class RestUtils
             LOG.error( error );
             throw new RestException( GlobalErrIds.REST_WEB_ERR, error, we );
         }
+        catch ( java.lang.NoSuchMethodError e )
+        {
+            String error = "post URI=[" + URI + "], function=[" + function
+                + "] caught Exception=" + e;
+            LOG.error( error );
+            e.printStackTrace();
+            throw new RestException( GlobalErrIds.REST_UNKNOWN_ERR, error );
+        }
         finally
         {
             // Release current connection to the connection pool.
@@ -334,15 +331,9 @@ public class RestUtils
     {
         if ( httpRequest instanceof HttpPost || httpRequest instanceof HttpPut)
         {
-            httpRequest.addHeader("Content-Type", "application/xml");
-            httpRequest.addHeader("Accept", "application/xml");
+            httpRequest.addHeader( "Content-Type", "application/xml" );
+            httpRequest.addHeader( "Accept", "application/xml" );
         }
-        //httpMethod.setDoAuthentication(false);
-//        httpRequest.setDoAuthentication(true);
-//        httpRequest.addHeader("Authorization",
-//                "Basic " + base64Encode(name + ":" + password));
-
-
     }
 
 


Mime
View raw message