You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by sa...@apache.org on 2012/04/24 09:06:33 UTC

svn commit: r1329571 - in /axis/axis2/java/core/branches/AXIS2-4318/modules: parent/ transport/http/ transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/ transport/http/test/org/apache/axis2/transport/http/

Author: sagara
Date: Tue Apr 24 07:06:32 2012
New Revision: 1329571

URL: http://svn.apache.org/viewvc?rev=1329571&view=rev
Log:
 AXIS2-4318 - Applied patch AXIS2-4318_02.patch.

Added:
    axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java   (with props)
    axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4TransportSenderTest.java   (with props)
Modified:
    axis/axis2/java/core/branches/AXIS2-4318/modules/parent/pom.xml
    axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/pom.xml
    axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HttpTransportPropertiesImpl.java

Modified: axis/axis2/java/core/branches/AXIS2-4318/modules/parent/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/parent/pom.xml?rev=1329571&r1=1329570&r2=1329571&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4318/modules/parent/pom.xml (original)
+++ axis/axis2/java/core/branches/AXIS2-4318/modules/parent/pom.xml Tue Apr 24 07:06:32 2012
@@ -90,6 +90,7 @@
         <geronimo.spec.saaj.version>1.0.1</geronimo.spec.saaj.version>
         <geronimo.spec.jaxws.version>1.0</geronimo.spec.jaxws.version>
         <httpcore.version>4.0</httpcore.version>
+        <httpclient.version>4.0</httpclient.version>
         <intellij.version>5.0</intellij.version>
         <jalopy.version>1.5rc3</jalopy.version>
         <jaxb.api.version>2.2.4</jaxb.api.version>
@@ -724,6 +725,11 @@
                 <version>${httpcore.version}</version>
             </dependency>
             <dependency>
+                <groupId>org.apache.httpcomponents</groupId>
+                <artifactId>httpclient</artifactId>
+                <version>${httpclient.version}</version>
+            </dependency>
+            <dependency>
                 <groupId>commons-fileupload</groupId>
                 <artifactId>commons-fileupload</artifactId>
                 <version>${commons.fileupload.version}</version>

Modified: axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/pom.xml?rev=1329571&r1=1329570&r2=1329571&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/pom.xml (original)
+++ axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/pom.xml Tue Apr 24 07:06:32 2012
@@ -106,8 +106,16 @@
             <artifactId>httpcore</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+        </dependency>
+        <dependency>
             <groupId>commons-httpclient</groupId>
             <artifactId>commons-httpclient</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+        </dependency>
     </dependencies>
 </project>

Added: axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java?rev=1329571&view=auto
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java (added)
+++ axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java Tue Apr 24 07:06:32 2012
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.http.impl.httpclient4;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.http.CommonsHTTPTransportSender;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.HTTPTransportConstants;
+import org.apache.axis2.transport.http.HTTPTransportSender;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+public class HTTPClient4TransportSender extends CommonsHTTPTransportSender implements
+                                                                           HTTPTransportSender {
+
+    private static final Log log = LogFactory.getLog(HTTPClient4TransportSender.class);
+
+    @Override
+    public void cleanup(MessageContext msgContext) throws AxisFault {
+        // We don't need to call cleanup here because httpclient4 releases
+        // the connection and cleanup automatically
+        // TODO : Don't do this if we're not on the right thread! Can we confirm?
+        log.trace("cleanup() releasing connection");
+        // guard against multiple calls
+        msgContext.removeProperty(HTTPConstants.HTTP_METHOD);
+
+    }
+
+    public void setHTTPClientVersion(ConfigurationContext configurationContext) {
+        configurationContext.setProperty(HTTPTransportConstants.HTTP_CLIENT_VERSION,
+                                         HTTPTransportConstants.HTTP_CLIENT_4_X_VERSION);
+    }
+
+
+}

Propchange: axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HttpTransportPropertiesImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HttpTransportPropertiesImpl.java?rev=1329571&r1=1329570&r2=1329571&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HttpTransportPropertiesImpl.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HttpTransportPropertiesImpl.java Tue Apr 24 07:06:32 2012
@@ -56,7 +56,6 @@ public class HttpTransportPropertiesImpl
         public static final String NTLM = AuthPolicy.NTLM;
         public static final String DIGEST = AuthPolicy.DIGEST;
         public static final String BASIC = AuthPolicy.BASIC;
-        public static final String SPNEGO = AuthPolicy.SPNEGO;
 
         public int getPort() {
             return port;
@@ -82,8 +81,6 @@ public class HttpTransportPropertiesImpl
                 return AuthPolicy.NTLM;
             } else if (DIGEST.equals(scheme)) {
                 return AuthPolicy.DIGEST;
-            } else if (SPNEGO.equals(scheme)) {
-                return AuthPolicy.SPNEGO;
             }
             return null;
         }

Added: axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4TransportSenderTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4TransportSenderTest.java?rev=1329571&view=auto
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4TransportSenderTest.java (added)
+++ axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4TransportSenderTest.java Tue Apr 24 07:06:32 2012
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.http;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.TransportSender;
+import org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender;
+import org.apache.http.client.methods.HttpGet;
+
+
+public class HTTPClient4TransportSenderTest extends CommonsHTTPTransportSenderTest{
+
+    @Override
+    protected TransportSender getTransportSender() {
+        return new HTTPClient4TransportSender();
+    }
+
+    @Override
+    public void testCleanup() throws AxisFault {
+        TransportSender sender = getTransportSender();
+        MessageContext msgContext = new MessageContext();
+        HttpGet httpMethod = new HttpGet();
+        msgContext.setProperty(HTTPConstants.HTTP_METHOD, httpMethod);
+        assertNotNull("HttpMethod can not be null",
+                msgContext.getProperty(HTTPConstants.HTTP_METHOD));
+        sender.cleanup(msgContext);
+        assertNull("HttpMethod should be null", msgContext.getProperty(HTTPConstants.HTTP_METHOD));
+    }
+}

Propchange: axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4TransportSenderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native