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 bi...@apache.org on 2020/04/14 20:03:06 UTC

[axis-axis2-java-core] branch AXIS2-4318 created (now 274b195)

This is an automated email from the ASF dual-hosted git repository.

billblough pushed a change to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git.


      at 274b195  Applied latest patch.

This branch includes the following new commits:

     new 130131b  [maven-release-plugin]  copy for branch AXIS2-4318
     new f58edf0  Creating a branch for AXIS2-4318.
     new 8fa50d5  Merged r1230421 to the AXIS2-4318 branch.
     new b0cdb27  AXIS2-4318 - Allows JAX-WS AxisInvocationController to set either HTTPClient 3.x or 4.x based HTTPSender. It is requited to set HTTPClient version as a property in  ConfigurationContext.
     new 730ee5d  AXIS2-4318 - Added HTTPClient 4.x into Import-Package.
     new 69270e8  AXIS2-4318 -  Refactoring existing codes.
     new 57f7acc  AXIS2-4318 - Refactored  test cases.
     new d767f27  Add few lines of comments.
     new 1099720  Merged r1324778 to the AXIS2-4318 branch.
     new 29806b4  Applied provided patch AXIS2-4318.
     new 9b7b802   AXIS2-4318 - Applied patch AXIS2-4318_02.patch.
     new 26ea9b9  Apply latest patch for AXIS2-4318.
     new 5cbc2cb  Applied latest patch.
     new 7f5ed0b  Deprecated HTTPProxcyConfigurator class.
     new 274b195  Applied latest patch.

The 15 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[axis-axis2-java-core] 12/15: Apply latest patch for AXIS2-4318.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit 26ea9b937f142fe9a022e99939d97d8e34536a68
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Mon Apr 30 10:04:10 2012 +0000

    Apply latest patch for AXIS2-4318.
---
 .../impl/httpclient4/HTTPProxyConfigurator.java    | 462 ++++++++++
 .../http/impl/httpclient4/HTTPSenderImpl.java      | 997 +++++++++++++++++++++
 .../transport/http/HTTPClient4SenderTest.java      | 178 ++++
 .../axis2/transport/http/HTTPSenderTest.java       |  13 +-
 4 files changed, 1643 insertions(+), 7 deletions(-)

diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPProxyConfigurator.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPProxyConfigurator.java
new file mode 100644
index 0000000..67615f4
--- /dev/null
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPProxyConfigurator.java
@@ -0,0 +1,462 @@
+/*
+ * 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.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.HTTPTransportConstants;
+import org.apache.axis2.transport.http.HttpTransportProperties;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.HttpHost;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.Credentials;
+import org.apache.http.auth.NTCredentials;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.params.ClientPNames;
+import org.apache.http.conn.params.ConnRoutePNames;
+import org.apache.http.impl.client.AbstractHttpClient;
+
+import javax.xml.namespace.QName;
+import java.net.URL;
+import java.util.StringTokenizer;
+
+
+public class HTTPProxyConfigurator {
+
+    private static Log log = LogFactory.getLog(HTTPProxyConfigurator.class);
+
+    /**
+     * Configure HTTP Proxy settings of commons-httpclient HostConfiguration.
+     * Proxy settings can be get from axis2.xml, Java proxy settings or can be
+     * override through property in message context.
+     * <p/>
+     * HTTP Proxy setting element format: <parameter name="Proxy">
+     * <Configuration> <ProxyHost>example.org</ProxyHost>
+     * <ProxyPort>3128</ProxyPort> <ProxyUser>EXAMPLE/John</ProxyUser>
+     * <ProxyPassword>password</ProxyPassword> <Configuration> <parameter>
+     *
+     * @param messageContext
+     *            in message context for
+     * @param httpClient
+     *            instance
+     * @throws org.apache.axis2.AxisFault
+     *             if Proxy settings are invalid
+     */
+    public static void configure(MessageContext messageContext, AbstractHttpClient httpClient)
+            throws AxisFault {
+
+        Credentials proxyCredentials = null;
+        String proxyHost = null;
+        String nonProxyHosts = null;
+        Integer proxyPort = -1;
+        String proxyUser = null;
+        String proxyPassword = null;
+
+        // Getting configuration values from Axis2.xml
+        Parameter proxySettingsFromAxisConfig = messageContext.getConfigurationContext()
+                .getAxisConfiguration().getParameter(HTTPTransportConstants.ATTR_PROXY);
+        if (proxySettingsFromAxisConfig != null) {
+            OMElement proxyConfiguration =
+                    getProxyConfigurationElement(proxySettingsFromAxisConfig);
+            proxyHost = getProxyHost(proxyConfiguration);
+            proxyPort = getProxyPort(proxyConfiguration);
+            proxyUser = getProxyUser(proxyConfiguration);
+            proxyPassword = getProxyPassword(proxyConfiguration);
+            if (proxyUser != null) {
+                if (proxyPassword == null) {
+                    proxyPassword = "";
+                }
+                int proxyUserDomainIndex = proxyUser.indexOf("\\");
+                if (proxyUserDomainIndex > 0) {
+                    String domain = proxyUser.substring(0, proxyUserDomainIndex);
+                    if (proxyUser.length() > proxyUserDomainIndex + 1) {
+                        String user = proxyUser.substring(proxyUserDomainIndex + 1);
+                        proxyCredentials = new NTCredentials(user, proxyPassword, proxyHost,
+                                                             domain);
+                    }
+                }
+                proxyCredentials = new UsernamePasswordCredentials(proxyUser, proxyPassword);
+            }
+
+        }
+
+        // If there is runtime proxy settings, these settings will override
+        // settings from axis2.xml
+        HttpTransportProperties.ProxyProperties proxyProperties =
+                (HttpTransportProperties.ProxyProperties) messageContext
+                .getProperty(HTTPConstants.PROXY);
+        if (proxyProperties != null) {
+            String proxyHostProp = proxyProperties.getProxyHostName();
+            if (proxyHostProp == null || proxyHostProp.length() <= 0) {
+                throw new AxisFault("HTTP Proxy host is not available. Host is a MUST parameter");
+            } else {
+                proxyHost = proxyHostProp;
+            }
+            proxyPort = proxyProperties.getProxyPort();
+
+            // Overriding credentials
+            String userName = proxyProperties.getUserName();
+            String password = proxyProperties.getPassWord();
+            String domain = proxyProperties.getDomain();
+
+            if (userName != null && password != null && domain != null) {
+                proxyCredentials = new NTCredentials(userName, password, proxyHost, domain);
+            } else if (userName != null && domain == null) {
+                proxyCredentials = new UsernamePasswordCredentials(userName, password);
+            }
+
+        }
+
+        // Overriding proxy settings if proxy is available from JVM settings
+        String host = System.getProperty(HTTPTransportConstants.HTTP_PROXY_HOST);
+        if (host != null) {
+            proxyHost = host;
+        }
+
+        String port = System.getProperty(HTTPTransportConstants.HTTP_PROXY_PORT);
+        if (port != null) {
+            proxyPort = Integer.parseInt(port);
+        }
+
+        if (proxyCredentials != null) {
+            // TODO : Set preemptive authentication, but its not recommended in HC 4
+            httpClient.getParams().setParameter(ClientPNames.HANDLE_AUTHENTICATION, true);
+
+            httpClient.getCredentialsProvider().setCredentials(AuthScope.ANY, proxyCredentials);
+            HttpHost proxy = new HttpHost(proxyHost, proxyPort);
+            httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
+
+        }
+    }
+
+    private static OMElement getProxyConfigurationElement(Parameter proxySettingsFromAxisConfig)
+            throws AxisFault {
+        OMElement proxyConfigurationElement = proxySettingsFromAxisConfig.getParameterElement()
+                .getFirstElement();
+        if (proxyConfigurationElement == null) {
+            log.error(HTTPTransportConstants.PROXY_CONFIGURATION_NOT_FOUND);
+            throw new AxisFault(HTTPTransportConstants.PROXY_CONFIGURATION_NOT_FOUND);
+        }
+        return proxyConfigurationElement;
+    }
+
+    private static String getProxyHost(OMElement proxyConfiguration) throws AxisFault {
+        OMElement proxyHostElement = proxyConfiguration.getFirstChildWithName(new QName(
+                HTTPTransportConstants.PROXY_HOST_ELEMENT));
+        if (proxyHostElement == null) {
+            log.error(HTTPTransportConstants.PROXY_HOST_ELEMENT_NOT_FOUND);
+            throw new AxisFault(HTTPTransportConstants.PROXY_HOST_ELEMENT_NOT_FOUND);
+        }
+        String proxyHost = proxyHostElement.getText();
+        if (proxyHost == null) {
+            log.error(HTTPTransportConstants.PROXY_HOST_ELEMENT_WITH_EMPTY_VALUE);
+            throw new AxisFault(HTTPTransportConstants.PROXY_HOST_ELEMENT_WITH_EMPTY_VALUE);
+        }
+        return proxyHost;
+    }
+
+    private static Integer getProxyPort(OMElement proxyConfiguration) throws AxisFault {
+        OMElement proxyPortElement = proxyConfiguration.getFirstChildWithName(new QName(
+                HTTPTransportConstants.PROXY_PORT_ELEMENT));
+        if (proxyPortElement == null) {
+            log.error(HTTPTransportConstants.PROXY_PORT_ELEMENT_NOT_FOUND);
+            throw new AxisFault(HTTPTransportConstants.PROXY_PORT_ELEMENT_NOT_FOUND);
+        }
+        String proxyPort = proxyPortElement.getText();
+        if (proxyPort == null) {
+            log.error(HTTPTransportConstants.PROXY_PORT_ELEMENT_WITH_EMPTY_VALUE);
+            throw new AxisFault(HTTPTransportConstants.PROXY_PORT_ELEMENT_WITH_EMPTY_VALUE);
+        }
+        return Integer.parseInt(proxyPort);
+    }
+
+    private static String getProxyUser(OMElement proxyConfiguration) {
+        OMElement proxyUserElement = proxyConfiguration.getFirstChildWithName(new QName(
+                HTTPTransportConstants.PROXY_USER_ELEMENT));
+        if (proxyUserElement == null) {
+            return null;
+        }
+        String proxyUser = proxyUserElement.getText();
+        if (proxyUser == null) {
+            log.warn("Empty user name element in HTTP Proxy settings.");
+            return null;
+        }
+
+        return proxyUser;
+    }
+
+    private static String getProxyPassword(OMElement proxyConfiguration) {
+        OMElement proxyPasswordElement = proxyConfiguration.getFirstChildWithName(new QName(
+                HTTPTransportConstants.PROXY_PASSWORD_ELEMENT));
+        if (proxyPasswordElement == null) {
+            return null;
+        }
+        String proxyUser = proxyPasswordElement.getText();
+        if (proxyUser == null) {
+            log.warn("Empty user name element in HTTP Proxy settings.");
+            return null;
+        }
+
+        return proxyUser;
+    }
+
+    /**
+     * Check whether http proxy is configured or active. This is not a deep
+     * check.
+     *
+     * @param messageContext
+     *            in message context
+     * @param targetURL
+     *            URL of the edpoint which we are sending the request
+     * @return true if proxy is enabled, false otherwise
+     */
+    public static boolean isProxyEnabled(MessageContext messageContext, URL targetURL) {
+        boolean proxyEnabled = false;
+
+        Parameter param = messageContext.getConfigurationContext().getAxisConfiguration()
+                .getParameter(HTTPTransportConstants.ATTR_PROXY);
+
+        // If configuration is over ridden
+        Object obj = messageContext.getProperty(HTTPConstants.PROXY);
+
+        // From Java Networking Properties
+        String sp = System.getProperty(HTTPTransportConstants.HTTP_PROXY_HOST);
+
+        if (param != null || obj != null || sp != null) {
+            proxyEnabled = true;
+        }
+
+        boolean isNonProxyHost = validateNonProxyHosts(targetURL.getHost());
+
+        return proxyEnabled && !isNonProxyHost;
+    }
+
+    /**
+     * Validates for names that shouldn't be listered as proxies. The
+     * http.nonProxyHosts can be set to specify the hosts which should be
+     * connected to directly (not through the proxy server). The value of the
+     * http.nonProxyHosts property can be a list of hosts, each separated by a
+     * |; it can also take a regular expression for matches; for example:
+     * *.sfbay.sun.com would match any fully qualified hostname in the sfbay
+     * domain.
+     * <p/>
+     * For more information refer to :
+     * http://java.sun.com/features/2002/11/hilevel_network.html
+     * <p/>
+     * false : validation fail : User can use the proxy true : validation pass ;
+     * User can't use the proxy
+     *
+     * @return boolean
+     */
+    private static boolean validateNonProxyHosts(String host) {
+        // From system property http.nonProxyHosts
+        String nonProxyHosts = System.getProperty(HTTPTransportConstants.HTTP_NON_PROXY_HOSTS);
+        return isHostInNonProxyList(host, nonProxyHosts);
+    }
+
+    /**
+     * Check if the specified host is in the list of non proxy hosts.
+     *
+     * @param host
+     *            host name
+     * @param nonProxyHosts
+     *            string containing the list of non proxy hosts
+     * @return true/false
+     */
+    public static boolean isHostInNonProxyList(String host, String nonProxyHosts) {
+        if ((nonProxyHosts == null) || (host == null)) {
+            return false;
+        }
+
+        /*
+         * The http.nonProxyHosts system property is a list enclosed in double
+         * quotes with items separated by a vertical bar.
+         */
+        StringTokenizer tokenizer = new StringTokenizer(nonProxyHosts, "|\"");
+
+        while (tokenizer.hasMoreTokens()) {
+            String pattern = tokenizer.nextToken();
+            if (match(pattern, host, false)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Matches a string against a pattern. The pattern contains two special
+     * characters: '*' which means zero or more characters,
+     *
+     * @param pattern
+     *            the (non-null) pattern to match against
+     * @param str
+     *            the (non-null) string that must be matched against the pattern
+     * @param isCaseSensitive
+     * @return <code>true</code> when the string matches against the pattern,
+     *         <code>false</code> otherwise.
+     */
+    private static boolean match(String pattern, String str, boolean isCaseSensitive) {
+
+        char[] patArr = pattern.toCharArray();
+        char[] strArr = str.toCharArray();
+        int patIdxStart = 0;
+        int patIdxEnd = patArr.length - 1;
+        int strIdxStart = 0;
+        int strIdxEnd = strArr.length - 1;
+        char ch;
+        boolean containsStar = false;
+
+        for (int i = 0; i < patArr.length; i++) {
+            if (patArr[i] == '*') {
+                containsStar = true;
+                break;
+            }
+        }
+        if (!containsStar) {
+
+            // No '*'s, so we make a shortcut
+            if (patIdxEnd != strIdxEnd) {
+                return false; // Pattern and string do not have the same size
+            }
+            for (int i = 0; i <= patIdxEnd; i++) {
+                ch = patArr[i];
+                if (isCaseSensitive && (ch != strArr[i])) {
+                    return false; // Character mismatch
+                }
+                if (!isCaseSensitive
+                        && (Character.toUpperCase(ch) != Character.toUpperCase(strArr[i]))) {
+                    return false; // Character mismatch
+                }
+            }
+            return true; // String matches against pattern
+        }
+        if (patIdxEnd == 0) {
+            return true; // Pattern contains only '*', which matches anything
+        }
+
+        // Process characters before first star
+        while ((ch = patArr[patIdxStart]) != '*' && (strIdxStart <= strIdxEnd)) {
+            if (isCaseSensitive && (ch != strArr[strIdxStart])) {
+                return false; // Character mismatch
+            }
+            if (!isCaseSensitive
+                    && (Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxStart]))) {
+                return false; // Character mismatch
+            }
+            patIdxStart++;
+            strIdxStart++;
+        }
+        if (strIdxStart > strIdxEnd) {
+
+            // All characters in the string are used. Check if only '*'s are
+            // left in the pattern. If so, we succeeded. Otherwise failure.
+            for (int i = patIdxStart; i <= patIdxEnd; i++) {
+                if (patArr[i] != '*') {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        // Process characters after last star
+        while ((ch = patArr[patIdxEnd]) != '*' && (strIdxStart <= strIdxEnd)) {
+            if (isCaseSensitive && (ch != strArr[strIdxEnd])) {
+                return false; // Character mismatch
+            }
+            if (!isCaseSensitive
+                    && (Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxEnd]))) {
+                return false; // Character mismatch
+            }
+            patIdxEnd--;
+            strIdxEnd--;
+        }
+        if (strIdxStart > strIdxEnd) {
+
+            // All characters in the string are used. Check if only '*'s are
+            // left in the pattern. If so, we succeeded. Otherwise failure.
+            for (int i = patIdxStart; i <= patIdxEnd; i++) {
+                if (patArr[i] != '*') {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        // process pattern between stars. padIdxStart and patIdxEnd point
+        // always to a '*'.
+        while ((patIdxStart != patIdxEnd) && (strIdxStart <= strIdxEnd)) {
+            int patIdxTmp = -1;
+
+            for (int i = patIdxStart + 1; i <= patIdxEnd; i++) {
+                if (patArr[i] == '*') {
+                    patIdxTmp = i;
+                    break;
+                }
+            }
+            if (patIdxTmp == patIdxStart + 1) {
+
+                // Two stars next to each other, skip the first one.
+                patIdxStart++;
+                continue;
+            }
+
+            // Find the pattern between padIdxStart & padIdxTmp in str between
+            // strIdxStart & strIdxEnd
+            int patLength = (patIdxTmp - patIdxStart - 1);
+            int strLength = (strIdxEnd - strIdxStart + 1);
+            int foundIdx = -1;
+
+            strLoop: for (int i = 0; i <= strLength - patLength; i++) {
+                for (int j = 0; j < patLength; j++) {
+                    ch = patArr[patIdxStart + j + 1];
+                    if (isCaseSensitive && (ch != strArr[strIdxStart + i + j])) {
+                        continue strLoop;
+                    }
+                    if (!isCaseSensitive
+                            && (Character.toUpperCase(ch) != Character
+                                    .toUpperCase(strArr[strIdxStart + i + j]))) {
+                        continue strLoop;
+                    }
+                }
+                foundIdx = strIdxStart + i;
+                break;
+            }
+            if (foundIdx == -1) {
+                return false;
+            }
+            patIdxStart = patIdxTmp;
+            strIdxStart = foundIdx + patLength;
+        }
+
+        // All characters in the string are used. Check if only '*'s are left
+        // in the pattern. If so, we succeeded. Otherwise failure.
+        for (int i = patIdxStart; i <= patIdxEnd; i++) {
+            if (patArr[i] != '*') {
+                return false;
+            }
+        }
+        return true;
+    }
+
+}
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
new file mode 100644
index 0000000..7723730
--- /dev/null
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
@@ -0,0 +1,997 @@
+/*
+ * 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.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.NamedValue;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.transport.TransportUtils;
+import org.apache.axis2.transport.http.HTTPAuthenticator;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.HTTPSender;
+import org.apache.axis2.transport.http.HTTPTransportConstants;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.Header;
+import org.apache.http.HeaderElement;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.HttpVersion;
+import org.apache.http.NameValuePair;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.Credentials;
+import org.apache.http.auth.NTCredentials;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.client.params.AuthPolicy;
+import org.apache.http.client.params.ClientPNames;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.scheme.PlainSocketFactory;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.impl.client.AbstractHttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.message.BasicHeader;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.BasicHttpContext;
+import org.apache.http.protocol.HTTP;
+import org.apache.http.protocol.HttpContext;
+
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.GZIPInputStream;
+
+
+public class HTTPSenderImpl extends HTTPSender {
+
+    private static final Log log = LogFactory.getLog(HTTPSenderImpl.class);
+
+    /**
+     * Used to send a request via HTTP Get method
+     *
+     * @param msgContext        - The MessageContext of the message
+     * @param url               - The target URL
+     * @param soapActionString - The soapAction string of the request
+     * @throws org.apache.axis2.AxisFault - Thrown in case an exception occurs
+     */
+    protected void sendViaGet(MessageContext msgContext, URL url, String soapActionString)
+            throws AxisFault {
+        HttpGet httpGet = new HttpGet();
+        AbstractHttpClient httpClient = getHttpClient(msgContext);
+        MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, httpGet,
+                                                                     httpClient, soapActionString);
+
+        // Need to have this here because we can have soap action when using the
+        // soap response MEP
+        String soapAction = messageFormatter
+                .formatSOAPAction(msgContext, format, soapActionString);
+
+        if (soapAction != null) {
+            httpGet.setHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
+        }
+
+        /*
+         * main execution takes place..
+         */
+        HttpResponse response = null;
+        try {
+            response = executeMethod(httpClient, msgContext, url, httpGet);
+            handleResponse(msgContext, response);
+        } catch (IOException e) {
+            log.info("Unable to sendViaGet to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            cleanup(msgContext, response);
+        }
+    }
+
+    @Override
+    protected void cleanup(MessageContext msgContext, Object httpResponse) {
+        HttpResponse response;
+        if (httpResponse instanceof HttpResponse) {
+            response = (HttpResponse) httpResponse;
+        } else {
+            log.trace("HttpResponse expected, but found - " + httpResponse);
+            return;
+        }
+        log.trace("Cleaning response : " + response);
+        HttpEntity entity = response.getEntity();
+        if (entity != null && entity.isStreaming()) {
+            InputStream inputStream;
+            try {
+                inputStream = entity.getContent();
+                if (inputStream != null) {
+                    inputStream.close();
+                }
+            } catch (IOException e) {
+                log.error("Error while cleaning response : "+response, e);
+            }
+        }
+    }
+
+    /**
+     * Used to send a request via HTTP Delete Method
+     *
+     * @param msgContext        - The MessageContext of the message
+     * @param url               - The target URL
+     * @param soapActionString - The soapAction string of the request
+     * @throws org.apache.axis2.AxisFault - Thrown in case an exception occurs
+     */
+    protected void sendViaDelete(MessageContext msgContext, URL url, String soapActionString)
+            throws AxisFault {
+
+        HttpDelete deleteMethod = new HttpDelete();
+        AbstractHttpClient httpClient = getHttpClient(msgContext);
+        populateCommonProperties(msgContext, url, deleteMethod, httpClient, soapActionString);
+
+        /*
+         * main execution takes place..
+         */
+        HttpResponse response = null;
+        try {
+            response = executeMethod(httpClient, msgContext, url, deleteMethod);
+            handleResponse(msgContext, response);
+        } catch (IOException e) {
+            log.info("Unable to sendViaDelete to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            cleanup(msgContext, response);
+        }
+    }
+
+    /**
+     * Used to send a request via HTTP Post Method
+     *
+     * @param msgContext       - The MessageContext of the message
+     * @param url              - The target URL
+     * @param soapActionString - The soapAction string of the request
+     * @throws org.apache.axis2.AxisFault - Thrown in case an exception occurs
+     */
+    protected void sendViaPost(MessageContext msgContext, URL url, String soapActionString)
+            throws AxisFault {
+
+        AbstractHttpClient httpClient = getHttpClient(msgContext);
+
+        /*
+         * What's up with this, it never gets used anywhere?? --Glen String
+         * charEncoding = (String)
+         * msgContext.getProperty(Constants.Configuration
+         * .CHARACTER_SET_ENCODING);
+         *
+         * if (charEncoding == null) { charEncoding =
+         * MessageContext.DEFAULT_CHAR_SET_ENCODING; }
+         */
+
+        HttpPost postMethod = new HttpPost();
+        if (log.isTraceEnabled()) {
+            log.trace(Thread.currentThread() + " PostMethod " + postMethod + " / " + httpClient);
+        }
+        MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, postMethod,
+                                                                     httpClient, soapActionString);
+        AxisRequestEntityImpl requestEntity =
+                new AxisRequestEntityImpl(messageFormatter, msgContext, format,
+                                          soapActionString, chunked, isAllowedRetry);
+        postMethod.setEntity(requestEntity);
+
+        if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) {
+            requestEntity.setChunked(chunked);
+        }
+
+        String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString);
+
+        if (soapAction != null) {
+            postMethod.setHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
+        }
+
+        /*
+         * main execution takes place..
+         */
+        HttpResponse response = null;
+        try {
+            response = executeMethod(httpClient, msgContext, url, postMethod);
+            handleResponse(msgContext, response);
+        } catch (IOException e) {
+            log.info("Unable to sendViaPost to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            cleanup(msgContext, response);
+        }
+    }
+
+    /**
+     * Used to send a request via HTTP Put Method
+     *
+     * @param msgContext       - The MessageContext of the message
+     * @param url              - The target URL
+     * @param soapActionString - The soapAction string of the request
+     * @throws org.apache.axis2.AxisFault - Thrown in case an exception occurs
+     */
+    protected void sendViaPut(MessageContext msgContext, URL url, String soapActionString)
+            throws AxisFault {
+
+        AbstractHttpClient httpClient = getHttpClient(msgContext);
+
+        /*
+         * Same deal - this value never gets used, why is it here? --Glen String
+         * charEncoding = (String)
+         * msgContext.getProperty(Constants.Configuration
+         * .CHARACTER_SET_ENCODING);
+         *
+         * if (charEncoding == null) { charEncoding =
+         * MessageContext.DEFAULT_CHAR_SET_ENCODING; }
+         */
+
+        HttpPut putMethod = new HttpPut();
+        MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, putMethod,
+                                                                     httpClient, soapActionString);
+        AxisRequestEntityImpl requestEntity =
+                new AxisRequestEntityImpl(messageFormatter, msgContext, format,
+                                          soapActionString, chunked, isAllowedRetry);
+        putMethod.setEntity(requestEntity);
+
+        if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) {
+            requestEntity.setChunked(chunked);
+        }
+
+        String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString);
+        if (soapAction != null) {
+            putMethod.setHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
+        }
+
+        /*
+         * main execution takes place..
+         */
+        HttpResponse response = null;
+        try {
+            response = executeMethod(httpClient, msgContext, url, putMethod);
+            handleResponse(msgContext, response);
+        } catch (IOException e) {
+            log.info("Unable to sendViaPut to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            cleanup(msgContext, response);
+        }
+    }
+
+    /**
+     * Used to handle the HTTP Response
+     *
+     * @param msgContext - The MessageContext of the message
+     * @param -          The HTTP method used
+     * @throws java.io.IOException - Thrown in case an exception occurs
+     */
+    protected void handleResponse(MessageContext msgContext, Object httpResponse)
+            throws IOException {
+        HttpResponse response;
+        if (httpResponse instanceof HttpResponse) {
+            response = (HttpResponse) httpResponse;
+        } else {
+            log.trace("HttpResponse expected, but found - " + httpResponse);
+            return;
+        }
+        int statusCode = response.getStatusLine().getStatusCode();
+        HTTPStatusCodeFamily family = getHTTPStatusCodeFamily(statusCode);
+        log.trace("Handling response - " + statusCode);
+        if (HTTPStatusCodeFamily.SUCCESSFUL.equals(family)) {
+            // Save the HttpMethod so that we can release the connection when
+            // cleaning up
+            // TODO : Do we need to save the http method
+//            msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
+
+            processResponse(response, msgContext);
+        } else if (statusCode == HttpStatus.SC_ACCEPTED) {
+            /*
+             * When an HTTP 202 Accepted code has been received, this will be
+             * the case of an execution of an in-only operation. In such a
+             * scenario, the HTTP response headers should be returned, i.e.
+             * session cookies.
+             */
+            obtainHTTPHeaderInformation(response.getEntity(), msgContext);
+
+        } else if (statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR
+                   || statusCode == HttpStatus.SC_BAD_REQUEST) {
+            // Save the HttpMethod so that we can release the connection when
+            // cleaning up
+//            msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
+            Header contentTypeHeader = response.getFirstHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+            String value = null;
+            if (contentTypeHeader != null) {
+                value = contentTypeHeader.getValue();
+            }
+            OperationContext opContext = msgContext.getOperationContext();
+            if (opContext != null) {
+                MessageContext inMessageContext = opContext
+                        .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+                if (inMessageContext != null) {
+                    inMessageContext.setProcessingFault(true);
+                }
+            }
+            if (value != null) {
+                processResponse(response, msgContext);
+            }
+
+            if (org.apache.axis2.util.Utils.isClientThreadNonBlockingPropertySet(msgContext)) {
+                throw new AxisFault(Messages.
+                        getMessage("transportError",
+                                   String.valueOf(statusCode),
+                                   response.getStatusLine().toString()));
+            }
+        } else {
+            throw new AxisFault(Messages.getMessage("transportError", String.valueOf(statusCode),
+                                                    response.getStatusLine().toString()));
+        }
+    }
+
+    /**
+     * Collect the HTTP header information and set them in the message context
+     *
+     * @param httpResponse which holds the header information
+     * @param msgContext the MessageContext in which to place the information... OR
+     *                   NOT!
+     * @throws AxisFault if problems occur
+     */
+    protected void obtainHTTPHeaderInformation(Object httpResponse, MessageContext msgContext)
+            throws AxisFault {
+        HttpResponse response;
+        if (httpResponse instanceof HttpResponse) {
+            response = (HttpResponse) httpResponse;
+        } else {
+            return;
+        }
+        // Set RESPONSE properties onto the REQUEST message context. They will
+        // need to be copied off the request context onto
+        // the response context elsewhere, for example in the
+        // OutInOperationClient.
+        Map transportHeaders = new HTTPTransportHeaders(response.getAllHeaders());
+        msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, transportHeaders);
+        msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE,
+                               new Integer(response.getStatusLine().getStatusCode()));
+        Header header = response.getFirstHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+
+        if (header != null) {
+            HeaderElement[] headers = header.getElements();
+            MessageContext inMessageContext = msgContext.getOperationContext().getMessageContext(
+                    WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+            Object contentType = header.getValue();
+            Object charSetEnc = null;
+
+            for (int i = 0; i < headers.length; i++) {
+                NameValuePair charsetEnc = headers[i]
+                        .getParameterByName(HTTPConstants.CHAR_SET_ENCODING);
+                if (charsetEnc != null) {
+                    charSetEnc = charsetEnc.getValue();
+                }
+            }
+
+            if (inMessageContext != null) {
+                inMessageContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentType);
+                inMessageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
+                                             charSetEnc);
+            } else {
+
+                // Transport details will be stored in a HashMap so that anybody
+                // interested can
+                // retrieve them
+                HashMap transportInfoMap = new HashMap();
+                transportInfoMap.put(Constants.Configuration.CONTENT_TYPE, contentType);
+                transportInfoMap.put(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
+
+                // the HashMap is stored in the outgoing message.
+                msgContext
+                        .setProperty(Constants.Configuration.TRANSPORT_INFO_MAP, transportInfoMap);
+            }
+        }
+
+        String sessionCookie = null;
+        // Process old style headers first
+        Header[] cookieHeaders = response.getHeaders(HTTPConstants.HEADER_SET_COOKIE);
+        String customCoookiId = (String) msgContext.getProperty(Constants.CUSTOM_COOKIE_ID);
+        for (int i = 0; i < cookieHeaders.length; i++) {
+            HeaderElement[] elements = cookieHeaders[i].getElements();
+            for (int e = 0; e < elements.length; e++) {
+                HeaderElement element = elements[e];
+                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName())
+                    || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
+                    sessionCookie = processCookieHeader(element);
+                }
+                if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) {
+                    sessionCookie = processCookieHeader(element);
+                }
+            }
+        }
+        // Overwrite old style cookies with new style ones if present
+        cookieHeaders = response.getHeaders(HTTPConstants.HEADER_SET_COOKIE2);
+        for (int i = 0; i < cookieHeaders.length; i++) {
+            HeaderElement[] elements = cookieHeaders[i].getElements();
+            for (int e = 0; e < elements.length; e++) {
+                HeaderElement element = elements[e];
+                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName())
+                    || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
+                    sessionCookie = processCookieHeader(element);
+                }
+                if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) {
+                    sessionCookie = processCookieHeader(element);
+                }
+            }
+        }
+
+        if (sessionCookie != null) {
+            msgContext.getServiceContext().setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
+        }
+    }
+
+    private String processCookieHeader(HeaderElement element) {
+        String cookie = element.getName() + "=" + element.getValue();
+        NameValuePair[] parameters = element.getParameters();
+        for (int j = 0; parameters != null && j < parameters.length; j++) {
+            NameValuePair parameter = parameters[j];
+            cookie = cookie + "; " + parameter.getName() + "=" + parameter.getValue();
+        }
+        return cookie;
+    }
+
+    protected void processResponse(HttpResponse response, MessageContext msgContext)
+            throws IOException {
+        obtainHTTPHeaderInformation(response, msgContext);
+
+        HttpEntity httpEntity = response.getEntity();
+        InputStream in = httpEntity.getContent();
+        if (in == null) {
+            throw new AxisFault(Messages.getMessage("canNotBeNull", "InputStream"));
+        }
+        Header contentEncoding = httpEntity.getContentEncoding();
+        if (contentEncoding != null) {
+            if (contentEncoding.getValue().equalsIgnoreCase(HTTPConstants.COMPRESSION_GZIP)) {
+                in = new GZIPInputStream(in);
+                // If the content-encoding is identity we can basically ignore
+                // it.
+            } else if (!"identity".equalsIgnoreCase(contentEncoding.getValue())) {
+                throw new AxisFault("HTTP :" + "unsupported content-encoding of '"
+                                    + contentEncoding.getValue() + "' found");
+            }
+        }
+
+        OperationContext opContext = msgContext.getOperationContext();
+        if (opContext != null) {
+            opContext.setProperty(MessageContext.TRANSPORT_IN, in);
+        }
+    }
+
+    /**
+     * getting host configuration to support standard http/s, proxy and NTLM
+     * support
+     *
+     * @param client    active HttpClient
+     * @param msgCtx    active MessageContext
+     * @param targetURL the target URL
+     * @return a HostConfiguration set up with proxy information
+     * @throws org.apache.axis2.AxisFault if problems occur
+     */
+    protected HttpHost getHostConfiguration(AbstractHttpClient client, MessageContext msgCtx,
+                                            URL targetURL) throws AxisFault {
+
+        boolean isAuthenticationEnabled = isAuthenticationEnabled(msgCtx);
+        int port = targetURL.getPort();
+
+        String protocol = targetURL.getProtocol();
+        if (port == -1) {
+            if (HTTPTransportConstants.PROTOCOL_HTTP.equals(protocol)) {
+                port = 80;
+            } else if (HTTPTransportConstants.PROTOCOL_HTTPS.equals(protocol)) {
+                port = 443;
+            }
+        }
+        // to see the host is a proxy and in the proxy list - available in
+        // axis2.xml
+        HttpHost hostConfig = new HttpHost(targetURL.getHost(), port, targetURL.getProtocol());
+
+        // TODO : one might need to set his own socket factory. We have to allow that case as well.
+
+        if (isAuthenticationEnabled) {
+            // Basic, Digest, NTLM and custom authentications.
+            this.setAuthenticationInfo(client, msgCtx);
+        }
+        // proxy configuration
+
+        if (HTTPProxyConfigurator.isProxyEnabled(msgCtx, targetURL)) {
+            if (log.isDebugEnabled()) {
+                log.debug("Configuring HTTP proxy.");
+            }
+            HTTPProxyConfigurator.configure(msgCtx, client);
+        }
+
+        return hostConfig;
+    }
+
+    protected boolean isAuthenticationEnabled(MessageContext msgCtx) {
+        return (msgCtx.getProperty(HTTPConstants.AUTHENTICATE) != null);
+    }
+
+    /*
+     * This will handle server Authentication, It could be either NTLM, Digest
+     * or Basic Authentication. Apart from that user can change the priory or
+     * add a custom authentication scheme.
+     */
+    protected void setAuthenticationInfo(AbstractHttpClient agent, MessageContext msgCtx)
+            throws AxisFault {
+        HTTPAuthenticator authenticator;
+        Object obj = msgCtx.getProperty(HTTPConstants.AUTHENTICATE);
+        if (obj != null) {
+            if (obj instanceof HTTPAuthenticator) {
+                authenticator = (HTTPAuthenticator) obj;
+
+                String username = authenticator.getUsername();
+                String password = authenticator.getPassword();
+                String host = authenticator.getHost();
+                String domain = authenticator.getDomain();
+
+                int port = authenticator.getPort();
+                String realm = authenticator.getRealm();
+
+                /* If retrying is available set it first */
+                isAllowedRetry = authenticator.isAllowedRetry();
+
+                Credentials creds;
+
+                // TODO : Set preemptive authentication, but its not recommended in HC 4
+
+                if (host != null) {
+                    if (domain != null) {
+                        /* Credentials for NTLM Authentication */
+                        //TODO : To enable NTLM we have to register the scheme with client, but it is available from 4.1 only
+//                        agent.getAuthSchemes().register("ntlm",new NTLMSchemeFactory());
+                        creds = new NTCredentials(username, password, host, domain);
+                    } else {
+                        /* Credentials for Digest and Basic Authentication */
+                        creds = new UsernamePasswordCredentials(username, password);
+                    }
+                    agent.getCredentialsProvider().
+                            setCredentials(new AuthScope(host, port, realm), creds);
+                } else {
+                    if (domain != null) {
+                        /*
+                         * Credentials for NTLM Authentication when host is
+                         * ANY_HOST
+                         */
+                        // TODO : Enable NTLM as metioned above
+                        creds = new NTCredentials(username, password, AuthScope.ANY_HOST, domain);
+                        agent.getCredentialsProvider().
+                                setCredentials(new AuthScope(AuthScope.ANY_HOST, port, realm),
+                                               creds);
+                    } else {
+                        /* Credentials only for Digest and Basic Authentication */
+                        creds = new UsernamePasswordCredentials(username, password);
+                        agent.getCredentialsProvider().
+                                setCredentials(new AuthScope(AuthScope.ANY), creds);
+                    }
+                }
+                /* Customizing the priority Order */
+                List schemes = authenticator.getAuthSchemes();
+                if (schemes != null && schemes.size() > 0) {
+                    List authPrefs = new ArrayList(3);
+                    for (int i = 0; i < schemes.size(); i++) {
+                        if (schemes.get(i) instanceof AuthPolicy) {
+                            authPrefs.add(schemes.get(i));
+                            continue;
+                        }
+                        String scheme = (String) schemes.get(i);
+                        authPrefs.add(authenticator.getAuthPolicyPref(scheme));
+
+                    }
+                    // TODO : This is available in 4.1 only
+//                    agent.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, authPrefs);
+                }
+
+            } else {
+                throw new AxisFault("HttpTransportProperties.Authenticator class cast exception");
+            }
+        }
+
+    }
+
+    /**
+     * Method used to copy all the common properties
+     *
+     * @param msgContext       - The messageContext of the request message
+     * @param url              - The target URL
+     * @param httpMethod       - The http method used to send the request
+     * @param httpClient       - The httpclient used to send the request
+     * @param soapActionString - The soap action atring of the request message
+     * @return MessageFormatter - The messageFormatter for the relavent request
+     *         message
+     * @throws org.apache.axis2.AxisFault - Thrown in case an exception occurs
+     */
+    protected MessageFormatter populateCommonProperties(MessageContext msgContext, URL url,
+                                                        HttpRequestBase httpMethod,
+                                                        AbstractHttpClient httpClient,
+                                                        String soapActionString)
+            throws AxisFault {
+
+        if (isAuthenticationEnabled(msgContext)) {
+            httpMethod.getParams().setBooleanParameter(ClientPNames.HANDLE_AUTHENTICATION, true);
+        }
+
+        MessageFormatter messageFormatter = TransportUtils.getMessageFormatter(msgContext);
+
+        url = messageFormatter.getTargetAddress(msgContext, format, url);
+
+        try {
+            httpMethod.setURI(url.toURI());
+        } catch (URISyntaxException e) {
+            log.error("Error in URI : " + url, e);
+        }
+
+        httpMethod.setHeader(HTTPConstants.HEADER_CONTENT_TYPE,
+                             messageFormatter.getContentType(msgContext, format, soapActionString));
+
+        httpMethod.setHeader(HTTPConstants.HEADER_HOST, url.getHost());
+
+        if (msgContext.getOptions() != null && msgContext.getOptions().isManageSession()) {
+            // setting the cookie in the out path
+            Object cookieString = msgContext.getProperty(HTTPConstants.COOKIE_STRING);
+
+            if (cookieString != null) {
+                StringBuffer buffer = new StringBuffer();
+                buffer.append(cookieString);
+                httpMethod.setHeader(HTTPConstants.HEADER_COOKIE, buffer.toString());
+            }
+        }
+
+        if (httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)) {
+            httpClient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION,
+                                                HttpVersion.HTTP_1_0);
+        }
+        return messageFormatter;
+    }
+
+    /**
+     * This is used to get the dynamically set time out values from the message
+     * context. If the values are not available or invalid then the default
+     * values or the values set by the configuration will be used
+     *
+     * @param msgContext the active MessageContext
+     * @param httpClient
+     */
+    protected void initializeTimeouts(MessageContext msgContext, AbstractHttpClient httpClient) {
+        // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
+        // override the static config
+        Integer tempSoTimeoutProperty = (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT);
+        Integer tempConnTimeoutProperty = (Integer) msgContext
+                .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
+        long timeout = msgContext.getOptions().getTimeOutInMilliSeconds();
+
+        if (tempConnTimeoutProperty != null) {
+            int connectionTimeout = tempConnTimeoutProperty.intValue();
+            // timeout for initial connection
+            httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,
+                                                connectionTimeout);
+        } else {
+            // set timeout in client
+            if (timeout > 0) {
+                httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,
+                                                    (int) timeout);
+            }
+        }
+
+        if (tempSoTimeoutProperty != null) {
+            int soTimeout = tempSoTimeoutProperty.intValue();
+            // SO_TIMEOUT -- timeout for blocking reads
+            httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, soTimeout);
+        } else {
+            // set timeout in client
+            if (timeout > 0) {
+                httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, (int) timeout);
+            }
+        }
+    }
+
+    /**
+     * This is used to get the dynamically set time out values from the message
+     * context. If the values are not available or invalid then the default
+     * values or the values set by the configuration will be used
+     *
+     * @param msgContext the active MessageContext
+     * @param httpMethod method
+     */
+    protected void setTimeouts(MessageContext msgContext, HttpRequestBase httpMethod) {
+        // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
+        // override the static config
+        Integer tempSoTimeoutProperty = (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT);
+        Integer tempConnTimeoutProperty = (Integer) msgContext
+                .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
+        long timeout = msgContext.getOptions().getTimeOutInMilliSeconds();
+
+        if (tempConnTimeoutProperty != null) {
+            // timeout for initial connection
+            httpMethod.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,
+                                                tempConnTimeoutProperty);
+        }
+
+        if (tempSoTimeoutProperty != null) {
+            // SO_TIMEOUT -- timeout for blocking reads
+            httpMethod.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT,
+                                                tempSoTimeoutProperty);
+        } else {
+            // set timeout in client
+            if (timeout > 0) {
+                httpMethod.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, (int) timeout);
+            }
+        }
+    }
+
+    protected AbstractHttpClient getHttpClient(MessageContext msgContext) {
+        ConfigurationContext configContext = msgContext.getConfigurationContext();
+
+        AbstractHttpClient httpClient = (AbstractHttpClient) msgContext
+                .getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
+
+        if (httpClient == null) {
+            httpClient = (AbstractHttpClient) configContext.
+                    getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
+        }
+
+        if (httpClient != null) {
+            return httpClient;
+        }
+
+        synchronized (this) {
+            httpClient = (AbstractHttpClient) msgContext.
+                    getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
+
+            if (httpClient == null) {
+                httpClient = (AbstractHttpClient) configContext
+                        .getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
+            }
+
+            if (httpClient != null) {
+                return httpClient;
+            }
+
+            ClientConnectionManager connManager = (ClientConnectionManager) msgContext
+                    .getProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
+            if (connManager == null) {
+                connManager = (ClientConnectionManager) msgContext
+                        .getProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
+            }
+            if (connManager == null) {
+                // reuse HttpConnectionManager
+                synchronized (configContext) {
+                    connManager = (ClientConnectionManager) configContext
+                            .getProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
+                    if (connManager == null) {
+                        log.trace("Making new ConnectionManager");
+                        SchemeRegistry schemeRegistry = new SchemeRegistry();
+                        schemeRegistry.register(
+                                new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
+                        schemeRegistry.register(
+                                new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
+
+                        connManager = new ThreadSafeClientConnManager(new BasicHttpParams(),
+                                                                      schemeRegistry);
+                        configContext.setProperty(
+                                HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER, connManager);
+                    }
+                }
+            }
+            /*
+             * Create a new instance of HttpClient since the way it is used here
+             * it's not fully thread-safe.
+             */
+            httpClient = new DefaultHttpClient(connManager, null);
+
+            //We don't need to set timeout for connection manager, since we are doing it below
+            // and its enough
+
+            // Get the timeout values set in the runtime
+            initializeTimeouts(msgContext, httpClient);
+
+            return httpClient;
+        }
+    }
+
+    protected HttpResponse executeMethod(AbstractHttpClient httpClient, MessageContext msgContext,
+                                         URL url,
+                                         HttpRequestBase method) throws IOException {
+        HttpHost httpHost = this.getHostConfiguration(httpClient, msgContext, url);
+
+        // set the custom headers, if available
+        addCustomHeaders(method, msgContext);
+
+        // add compression headers if needed
+        if (msgContext.isPropertyTrue(HTTPConstants.MC_ACCEPT_GZIP)) {
+            method.addHeader(HTTPConstants.HEADER_ACCEPT_ENCODING,
+                             HTTPConstants.COMPRESSION_GZIP);
+        }
+
+        if (msgContext.isPropertyTrue(HTTPConstants.MC_GZIP_REQUEST)) {
+            method.addHeader(HTTPConstants.HEADER_CONTENT_ENCODING,
+                             HTTPConstants.COMPRESSION_GZIP);
+        }
+
+        if (msgContext.getProperty(HTTPConstants.HTTP_METHOD_PARAMS) != null) {
+            HttpParams params = (HttpParams) msgContext
+                    .getProperty(HTTPConstants.HTTP_METHOD_PARAMS);
+            method.setParams(params);
+        }
+
+        String cookiePolicy = (String) msgContext.getProperty(HTTPConstants.COOKIE_POLICY);
+        if (cookiePolicy != null) {
+            method.getParams().setParameter(ClientPNames.COOKIE_POLICY, cookiePolicy);
+        }
+
+        setTimeouts(msgContext, method);
+        HttpContext localContext = new BasicHttpContext();
+        // Why do we have add context here
+        return httpClient.execute(httpHost, method, localContext);
+    }
+
+    public void addCustomHeaders(HttpRequestBase method, MessageContext msgContext) {
+
+        boolean isCustomUserAgentSet = false;
+        // set the custom headers, if available
+        Object httpHeadersObj = msgContext.getProperty(HTTPConstants.HTTP_HEADERS);
+        if (httpHeadersObj != null) {
+            if (httpHeadersObj instanceof List) {
+                List httpHeaders = (List) httpHeadersObj;
+                for (int i = 0; i < httpHeaders.size(); i++) {
+                    NamedValue nv = (NamedValue) httpHeaders.get(i);
+                    if (nv != null) {
+                        Header header = new BasicHeader(nv.getName(), nv.getValue());
+                        if (HTTPConstants.HEADER_USER_AGENT.equals(header.getName())) {
+                            isCustomUserAgentSet = true;
+                        }
+                        method.addHeader(header);
+                    }
+                }
+
+            }
+            if (httpHeadersObj instanceof Map) {
+                Map httpHeaders = (Map) httpHeadersObj;
+                for (Iterator iterator = httpHeaders.entrySet().iterator(); iterator.hasNext(); ) {
+                    Map.Entry entry = (Map.Entry) iterator.next();
+                    String key = (String) entry.getKey();
+                    String value = (String) entry.getValue();
+                    if (HTTPConstants.HEADER_USER_AGENT.equals(key)) {
+                        isCustomUserAgentSet = true;
+                    }
+                    method.addHeader(key, value);
+                }
+            }
+        }
+
+        // we have to consider the TRANSPORT_HEADERS map as well
+        Map transportHeaders = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
+        if (transportHeaders != null) {
+            removeUnwantedHeaders(msgContext);
+
+            Set headerEntries = transportHeaders.entrySet();
+
+            for (Object headerEntry : headerEntries) {
+                if (headerEntry instanceof Map.Entry) {
+                    Header[] headers = method.getAllHeaders();
+
+                    boolean headerAdded = false;
+                    for (Header header : headers) {
+                        if (header.getName() != null
+                            && header.getName().equals(((Map.Entry) headerEntry).getKey())) {
+                            headerAdded = true;
+                            break;
+                        }
+                    }
+
+                    if (!headerAdded) {
+                        method.addHeader(((Map.Entry) headerEntry).getKey().toString(),
+                                         ((Map.Entry) headerEntry).getValue().toString());
+                    }
+                }
+            }
+        }
+
+        if (!isCustomUserAgentSet) {
+            String userAgentString = getUserAgent(msgContext);
+            method.setHeader(HTTPConstants.HEADER_USER_AGENT, userAgentString);
+        }
+
+    }
+
+    /**
+     * Remove unwanted headers from the transport headers map of outgoing
+     * request. These are headers which should be dictated by the transport and
+     * not the user. We remove these as these may get copied from the request
+     * messages
+     *
+     * @param msgContext the Axis2 Message context from which these headers should be
+     *                   removed
+     */
+    private void removeUnwantedHeaders(MessageContext msgContext) {
+        Map headers = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
+
+        if (headers == null || headers.isEmpty()) {
+            return;
+        }
+
+        Iterator iter = headers.keySet().iterator();
+        while (iter.hasNext()) {
+            String headerName = (String) iter.next();
+            if (HTTP.CONN_DIRECTIVE.equalsIgnoreCase(headerName)
+                || HTTP.TRANSFER_ENCODING.equalsIgnoreCase(headerName)
+                || HTTP.DATE_HEADER.equalsIgnoreCase(headerName)
+                || HTTP.CONTENT_TYPE.equalsIgnoreCase(headerName)
+                || HTTP.CONTENT_LEN.equalsIgnoreCase(headerName)) {
+                iter.remove();
+            }
+        }
+    }
+
+    private String getUserAgent(MessageContext messageContext) {
+        String userAgentString = "Axis2";
+        boolean locked = false;
+        if (messageContext.getParameter(HTTPConstants.USER_AGENT) != null) {
+            OMElement userAgentElement = messageContext.getParameter(HTTPConstants.USER_AGENT)
+                    .getParameterElement();
+            userAgentString = userAgentElement.getText().trim();
+            OMAttribute lockedAttribute = userAgentElement.getAttribute(new QName("locked"));
+            if (lockedAttribute != null) {
+                if (lockedAttribute.getAttributeValue().equalsIgnoreCase("true")) {
+                    locked = true;
+                }
+            }
+        }
+        // Runtime overing part
+        if (!locked) {
+            if (messageContext.getProperty(HTTPConstants.USER_AGENT) != null) {
+                userAgentString = (String) messageContext.getProperty(HTTPConstants.USER_AGENT);
+            }
+        }
+
+        return userAgentString;
+    }
+
+}
diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4SenderTest.java b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4SenderTest.java
new file mode 100644
index 0000000..a7c697b
--- /dev/null
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4SenderTest.java
@@ -0,0 +1,178 @@
+/*
+* 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.Constants;
+import org.apache.axis2.transport.http.impl.httpclient4.HTTPSenderImpl;
+
+import javax.ws.rs.core.HttpHeaders;
+
+public class HTTPClient4SenderTest extends HTTPSenderTest {
+
+    @Override
+    protected HTTPSender getHTTPSender() {
+        return new HTTPSenderImpl();
+    }
+
+    @Override
+    public void testSendViaGet() throws Exception {
+        int port = getBasicHttpServer().getPort();
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_GET, "urn:getService", "http://localhost:"
+                                                                               + port + "/getService", true);
+        assertEquals("Not the expected HTTP Method", Constants.Configuration.HTTP_METHOD_GET,
+                     getHTTPMethod());
+        assertEquals("Not the expected content", "/getService?part=sample%20data",
+                     getStringContent());
+        assertEquals("Not the expected HTTP Header value", "urn:getService",
+                     getHeaders().get("SOAPAction"));
+        assertEquals("Not the expected HTTP Header value",
+                     "application/x-www-form-urlencoded;action=\"urn:getService\";",
+                     getHeaders().get(HttpHeaders.CONTENT_TYPE));
+        assertEquals("Not the expected HTTP Header value", "localhost",
+                     getHeaders().get(HttpHeaders.HOST));
+        assertEquals("Not the expected HTTP Header value", "Axis2",
+                     getHeaders().get(HttpHeaders.USER_AGENT));
+    }
+
+    @Override
+    public void testSendViaPost() throws Exception {
+        // test with REST payload
+        int port = getBasicHttpServer().getPort();
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_POST, "urn:postService",
+                    "http://localhost:" + port + "/postService", true);
+        assertEquals("Not the expected HTTP Method", Constants.Configuration.HTTP_METHOD_POST,
+                     getHTTPMethod());
+        assertEquals("Not the expected content", getEnvelope().getFirstElement().getFirstElement()
+                .toString(), getStringContent());
+        assertEquals("Not the expected HTTP Header value", "urn:postService",
+                     getHeaders().get("SOAPAction"));
+        assertEquals("Not the expected HTTP Header value", "application/xml",
+                     getHeaders().get(HttpHeaders.CONTENT_TYPE));
+        assertEquals("Not the expected HTTP Header value", "localhost",
+                     getHeaders().get(HttpHeaders.HOST));
+        assertEquals("Not the expected HTTP Header value", "Axis2",
+                     getHeaders().get(HttpHeaders.USER_AGENT));
+
+        // test with SOAP payload.
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_POST, "urn:postService",
+                    "http://localhost:" + port + "/postService", false);
+        assertEquals("Not the expected HTTP Method", Constants.Configuration.HTTP_METHOD_POST,
+                     getHTTPMethod());
+        assertEquals("Not the expected content", getEnvelope().toString(), getStringContent());
+        assertEquals("Not the expected HTTP Header value", "urn:postService",
+                     getHeaders().get("SOAPAction").replace("\"", ""));
+        assertEquals("Not the expected HTTP Header value", "text/xml",
+                     getHeaders().get(HttpHeaders.CONTENT_TYPE));
+        assertEquals("Not the expected HTTP Header value", "localhost",
+                     getHeaders().get(HttpHeaders.HOST));
+        assertEquals("Not the expected HTTP Header value", "Axis2",
+                     getHeaders().get(HttpHeaders.USER_AGENT));
+    }
+
+    @Override
+    public void testSendViaPut() throws Exception {
+        // test with REST payload
+        int port = getBasicHttpServer().getPort();
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_PUT, "urn:putService", "http://localhost:"
+                                                                               + port + "/putService", true);
+        assertEquals("Not the expected HTTP Method", Constants.Configuration.HTTP_METHOD_PUT,
+                     getHTTPMethod());
+        assertEquals("Not the expected content", getEnvelope().getFirstElement().getFirstElement()
+                .toString(), getStringContent());
+        assertEquals("Not the expected HTTP Header value", "urn:putService",
+                     getHeaders().get("SOAPAction"));
+        assertEquals("Not the expected HTTP Header value", "application/xml",
+                     getHeaders().get(HttpHeaders.CONTENT_TYPE));
+        assertEquals("Not the expected HTTP Header value", "localhost",
+                     getHeaders().get(HttpHeaders.HOST));
+        assertEquals("Not the expected HTTP Header value", "Axis2",
+                     getHeaders().get(HttpHeaders.USER_AGENT));
+
+        // test with SOAP payload.
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_PUT, "urn:putService", "http://localhost:"
+                                                                               + port + "/putService", false);
+        assertEquals("Not the expected HTTP Method", Constants.Configuration.HTTP_METHOD_PUT,
+                     getHTTPMethod());
+        assertEquals("Not the expected content", getEnvelope().toString(), getStringContent());
+        assertEquals("Not the expected HTTP Header value", "urn:putService",
+                     getHeaders().get("SOAPAction").replace("\"", ""));
+        assertEquals("Not the expected HTTP Header value", "text/xml",
+                     getHeaders().get(HttpHeaders.CONTENT_TYPE));
+        assertEquals("Not the expected HTTP Header value", "localhost",
+                     getHeaders().get(HttpHeaders.HOST));
+        assertEquals("Not the expected HTTP Header value", "Axis2",
+                     getHeaders().get(HttpHeaders.USER_AGENT));
+    }
+
+    @Override
+    public void testSendViaDelete() throws Exception {
+        // test with REST payload
+        int port = getBasicHttpServer().getPort();
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_DELETE, "urn:deleteService",
+                    "http://localhost:" + port + "/deleteService", true);
+        assertEquals("Not the expected HTTP Method", Constants.Configuration.HTTP_METHOD_DELETE,
+                     getHTTPMethod());
+        assertEquals("Not the expected content", "/deleteService?part=sample%20data",
+                     getStringContent());
+        assertEquals("Not the expected HTTP Header value",
+                     "application/x-www-form-urlencoded;action=\"urn:deleteService\";", getHeaders()
+                .get(HttpHeaders.CONTENT_TYPE));
+        assertEquals("Not the expected HTTP Header value", "localhost",
+                     getHeaders().get(HttpHeaders.HOST));
+        assertEquals("Not the expected HTTP Header value", "Axis2",
+                     getHeaders().get(HttpHeaders.USER_AGENT));
+    }
+
+    @Override
+    public void testSendViaHead() throws Exception {
+        int port = getBasicHttpServer().getPort();
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_HEAD, "urn:deleteService",
+                    "http://localhost:" + port + "/deleteService", true);
+        assertEquals("Not the expected HTTP Method", Constants.Configuration.HTTP_METHOD_POST,
+                     getHTTPMethod());
+        assertEquals("Not the expected content", getEnvelope().getFirstElement().getFirstElement()
+                .toString(), getStringContent());
+        assertEquals("Not the expected HTTP Header value", "application/xml",
+                     getHeaders().get(HttpHeaders.CONTENT_TYPE));
+        assertEquals("Not the expected HTTP Header value", "localhost",
+                     getHeaders().get(HttpHeaders.HOST));
+        assertEquals("Not the expected HTTP Header value", "Axis2",
+                     getHeaders().get(HttpHeaders.USER_AGENT));
+
+    }
+
+    @Override
+    public void testSendNOHTTPMethod() throws Exception {
+        int port = getBasicHttpServer().getPort();
+        sendViaHTTP(null, "urn:noService", "http://localhost:" + port + "/noService", true);
+        assertEquals("Not the expected HTTP Method", Constants.Configuration.HTTP_METHOD_POST,
+                     getHTTPMethod());
+        assertEquals("Not the expected content", getEnvelope().getFirstElement().getFirstElement()
+                .toString(), getStringContent());
+        assertEquals("Not the expected HTTP Header value", "urn:noService",
+                     getHeaders().get("SOAPAction"));
+        assertEquals("Not the expected HTTP Header value", "application/xml",
+                     getHeaders().get(HttpHeaders.CONTENT_TYPE));
+        assertEquals("Not the expected HTTP Header value", "localhost",
+                     getHeaders().get(HttpHeaders.HOST));
+        assertEquals("Not the expected HTTP Header value", "Axis2",
+                     getHeaders().get(HttpHeaders.USER_AGENT));
+    }
+}
diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
index d51b28d..96691d4 100644
--- a/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
@@ -19,12 +19,6 @@
 
 package org.apache.axis2.transport.http;
 
-import java.io.IOException;
-import java.net.URL;
-
-import javax.mail.MessagingException;
-import javax.ws.rs.core.HttpHeaders;
-
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
@@ -33,6 +27,11 @@ import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.transport.http.mock.server.AbstractHTTPServerTest;
 import org.apache.axis2.transport.http.mock.server.BasicHttpServer;
 
+import javax.mail.MessagingException;
+import javax.ws.rs.core.HttpHeaders;
+import java.io.IOException;
+import java.net.URL;
+
 /**
  * The Class HTTPSenderTest.
  */
@@ -58,7 +57,7 @@ public abstract class HTTPSenderTest extends AbstractHTTPServerTest {
      * @throws MessagingException
      *             the messaging exception
      */
-    private void sendViaHTTP(String httpMethod, String soapAction, String address, boolean rest)
+    protected void sendViaHTTP(String httpMethod, String soapAction, String address, boolean rest)
             throws IOException, MessagingException {
         httpSender = getHTTPSender();
         MessageContext msgContext = new MessageContext();


[axis-axis2-java-core] 04/15: AXIS2-4318 - Allows JAX-WS AxisInvocationController to set either HTTPClient 3.x or 4.x based HTTPSender. It is requited to set HTTPClient version as a property in ConfigurationContext.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit b0cdb279e59f085a3f4fa44a7fed4f0021276604
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Thu Jan 12 09:17:34 2012 +0000

    AXIS2-4318 - Allows JAX-WS AxisInvocationController to set either HTTPClient 3.x or 4.x based HTTPSender. It is requited to set HTTPClient version as a property in  ConfigurationContext.
---
 .../controller/impl/AxisInvocationController.java  | 35 ++++++++++++++++------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java b/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java
index d0ba927..cb4da9c 100644
--- a/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java
+++ b/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java
@@ -19,7 +19,6 @@
 
 package org.apache.axis2.jaxws.core.controller.impl;
 
-import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants.Configuration;
 import org.apache.axis2.addressing.EndpointReference;
@@ -34,11 +33,9 @@ import org.apache.axis2.jaxws.client.ClientUtils;
 import org.apache.axis2.jaxws.client.async.AsyncResponse;
 import org.apache.axis2.jaxws.client.async.CallbackFuture;
 import org.apache.axis2.jaxws.client.async.PollingFuture;
-import org.apache.axis2.jaxws.client.dispatch.XMLDispatch;
 import org.apache.axis2.jaxws.core.InvocationContext;
 import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.description.OperationDescription;
-import org.apache.axis2.jaxws.description.builder.MDQConstants;
 import org.apache.axis2.jaxws.handler.HandlerChainProcessor;
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.message.Message;
@@ -47,8 +44,9 @@ import org.apache.axis2.jaxws.message.util.MessageUtils;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
 import org.apache.axis2.jaxws.util.Constants;
 import org.apache.axis2.jaxws.utility.ClassUtils;
+import org.apache.axis2.transport.http.HTTPAuthenticator;
 import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.transport.http.HttpTransportProperties;
+import org.apache.axis2.transport.http.HTTPTransportConstants;
 import org.apache.axis2.util.ThreadContextMigratorUtil;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
@@ -56,10 +54,8 @@ import org.apache.commons.logging.LogFactory;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.AsyncHandler;
-import javax.xml.ws.Dispatch;
 import javax.xml.ws.Response;
 import javax.xml.ws.WebServiceException;
-import javax.xml.ws.Service.Mode;
 
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -521,9 +517,19 @@ public class AxisInvocationController extends InvocationControllerImpl {
             catch (MalformedURLException e) {
                 throw ExceptionFactory.makeWebServiceException(e);
             }
-
-            HttpTransportProperties.Authenticator basicAuthentication =
-                    new HttpTransportProperties.Authenticator();
+            
+            /*
+             * Check HTTPClient version to set HTTPAuthenticator. By default it
+             * use HTTPClient 3.x
+             */
+            HTTPAuthenticator basicAuthentication = null;           
+            String httpClientVersion = getHTTPClientVersion(mc.getAxisMessageContext());
+            if (httpClientVersion != null
+                    && HTTPTransportConstants.HTTP_CLIENT_4_X_VERSION.equals(httpClientVersion)) {
+                //basicAuthentication = new org.apache.axis2.transport.http.impl.httpclient4.HttpTransportPropertiesImpl.Authenticator();
+            } else {
+                basicAuthentication = new org.apache.axis2.transport.http.impl.httpclient3.HttpTransportPropertiesImpl.Authenticator();
+            }         
             basicAuthentication.setUsername(userId);
             basicAuthentication.setPassword(password);
             basicAuthentication.setHost(url.getHost());
@@ -694,4 +700,15 @@ public class AxisInvocationController extends InvocationControllerImpl {
         return soapFaultDisabled;
     }
 
+    private String getHTTPClientVersion(org.apache.axis2.context.MessageContext msgCtx) {
+        /*
+         * TODO - 
+         * 1.) Need to read HTTPClient version property value from
+         *     ConfigurationContext. 
+         * 2.) pre-condition, Have to set above value to the
+         *     ConfigurationContext.
+         */
+        return null;
+    }
+
 }


[axis-axis2-java-core] 02/15: Creating a branch for AXIS2-4318.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit f58edf0fb23311f1b81e472c2380b6d091f8a661
Merge: 130131b 87ddba7
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Thu Jan 12 06:10:17 2012 +0000

    Creating a branch for AXIS2-4318.

 modules/adb-codegen/pom.xml                        |   6 +-
 modules/adb/pom.xml                                |   6 +-
 modules/addressing/pom.xml                         |   6 +-
 modules/clustering/pom.xml                         |   6 +-
 modules/codegen/pom.xml                            |   6 +-
 modules/corba/pom.xml                              |   6 +-
 modules/fastinfoset/pom.xml                        |   6 +-
 modules/integration/pom.xml                        |   6 +-
 modules/java2wsdl/pom.xml                          |   6 +-
 modules/jaxbri/pom.xml                             |   6 +-
 modules/jaxws-integration/pom.xml                  |   6 +-
 modules/jaxws-mar/pom.xml                          |   6 +-
 modules/jaxws/pom.xml                              |   6 +-
 .../controller/impl/AxisInvocationController.java  |  29 +-
 modules/jibx/pom.xml                               |   6 +-
 modules/json/pom.xml                               |   6 +-
 modules/kernel/pom.xml                             |   6 +-
 modules/metadata/pom.xml                           |   6 +-
 modules/mex/pom.xml                                |   6 +-
 modules/mtompolicy-mar/pom.xml                     |   6 +-
 modules/mtompolicy/pom.xml                         |   6 +-
 modules/osgi/pom.xml                               |   6 +-
 modules/parent/pom.xml                             |   6 +-
 modules/ping/pom.xml                               |   6 +-
 modules/resource-bundle/pom.xml                    |   6 +-
 modules/saaj/pom.xml                               |   6 +-
 modules/samples/version/pom.xml                    |   6 +-
 modules/scripting/pom.xml                          |   6 +-
 modules/soapmonitor/module/pom.xml                 |   6 +-
 modules/soapmonitor/servlet/pom.xml                |   6 +-
 modules/spring/pom.xml                             |   6 +-
 modules/testutils/pom.xml                          |   6 +-
 modules/tool/axis2-aar-maven-plugin/pom.xml        |   6 +-
 modules/tool/axis2-ant-plugin/pom.xml              |   6 +-
 modules/tool/axis2-eclipse-codegen-plugin/pom.xml  |   6 +-
 modules/tool/axis2-eclipse-service-plugin/pom.xml  |   6 +-
 modules/tool/axis2-idea-plugin/pom.xml             |   6 +-
 modules/tool/axis2-java2wsdl-maven-plugin/pom.xml  |   6 +-
 modules/tool/axis2-mar-maven-plugin/pom.xml        |   6 +-
 modules/tool/axis2-repo-maven-plugin/pom.xml       |   6 +-
 modules/tool/axis2-wsdl2code-maven-plugin/pom.xml  |   6 +-
 modules/tool/simple-server-maven-plugin/pom.xml    |   6 +-
 modules/transport/http/pom.xml                     |   6 +-
 .../axis2/transport/http/AbstractHTTPSender.java   | 689 ++++++++++++++++++++-
 .../axis2/transport/http/AxisRequestEntity.java    |  15 +-
 .../apache/axis2/transport/http/AxisServlet.java   |  20 +-
 .../transport/http/CommonsHTTPTransportSender.java |  39 +-
 .../transport/http/CommonsTransportHeaders.java    |  30 +-
 .../apache/axis2/transport/http/HTTPSender.java    | 281 +++++++--
 .../transport/http/HttpTransportProperties.java    | 136 +++-
 .../axis2/transport/http/RESTRequestEntity.java    |  62 +-
 .../axis2/transport/http/RESTRequestEntity2.java   |  20 +-
 .../http/util/HTTPProxyConfigurationUtil.java      |   1 -
 .../CommonsHTTPTransportSenderClientSideTest.java  |   3 +-
 .../http/CommonsHTTPTransportSenderTest.java       |  17 +-
 .../axis2/transport/http/HTTPSenderTest.java       |   8 +-
 modules/transport/local/pom.xml                    |   6 +-
 modules/webapp/pom.xml                             |   6 +-
 modules/xmlbeans/pom.xml                           |   6 +-
 pom.xml                                            |   6 +-
 60 files changed, 1233 insertions(+), 393 deletions(-)


[axis-axis2-java-core] 08/15: Add few lines of comments.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit d767f27621bc5eab2486e9a50f024e77eebacb8b
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Wed Apr 11 14:10:47 2012 +0000

    Add few lines of comments.
---
 .../apache/axis2/transport/http/CommonsHTTPTransportSender.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java b/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
index 4181a56..f0a123d 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
@@ -76,7 +76,12 @@ public class CommonsHTTPTransportSender extends AbstractHandler implements HTTPT
     private int soTimeout = HTTPConstants.DEFAULT_SO_TIMEOUT;
 
     private int connectionTimeout = HTTPConstants.DEFAULT_CONNECTION_TIMEOUT;
-
+    
+    /*
+     * It's Required to keep this method to keep backward compatibility because
+     * still it's possible to register CommonsHTTPTransportSender in the
+     * axis2.xml.
+     */
     public void cleanup(MessageContext msgContext) throws AxisFault {
         
             HttpMethod httpMethod = (HttpMethod) msgContext.getProperty(HTTPConstants.HTTP_METHOD);


[axis-axis2-java-core] 10/15: Applied provided patch AXIS2-4318.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit 29806b4d82fd045a94d0285dcf25003713a65b16
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Wed Apr 18 12:16:43 2012 +0000

    Applied provided patch AXIS2-4318.
---
 .../axis2/transport/http/AxisRequestEntity.java    |  6 ++
 .../axis2/transport/http/RESTRequestEntity2.java   |  8 +-
 .../impl/httpclient4/AxisRequestEntityImpl.java    | 81 +++++++++++++++++++
 .../impl/httpclient4/HTTPTransportHeaders.java     | 44 ++++++++++
 .../httpclient4/HttpTransportPropertiesImpl.java   | 93 ++++++++++++++++++++++
 .../impl/httpclient4/RESTRequestEntity2Impl.java   | 65 +++++++++++++++
 .../impl/httpclient4/RESTRequestEntityImpl.java    | 68 ++++++++++++++++
 7 files changed, 364 insertions(+), 1 deletion(-)

diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java b/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java
index 8834def..2fe3e2e 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java
@@ -26,7 +26,9 @@ import org.apache.axis2.transport.MessageFormatter;
 import org.apache.axis2.util.JavaUtils;
 
 import javax.xml.stream.FactoryConfigurationError;
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.zip.GZIPOutputStream;
 
@@ -124,6 +126,10 @@ public abstract class AxisRequestEntity  {
     public void setChunked(boolean chunked) {
         this.chunked = chunked;
     }
+
+    public InputStream getRequestEntityContent() throws IOException {
+        return new ByteArrayInputStream(messageFormatter.getBytes(messageContext, format));
+    }
     
     
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java b/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
index 434b127..1dfa528 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
@@ -19,7 +19,9 @@
 
 package org.apache.axis2.transport.http;
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
 
 public abstract class RESTRequestEntity2 {
@@ -59,5 +61,9 @@ public abstract class RESTRequestEntity2 {
     public void setPostRequestBody(String postRequestBody) {
         this.postRequestBody = postRequestBody;
     }
-    
+
+    public InputStream getRequestEntityContent() {
+        return new ByteArrayInputStream(this.postRequestBody.getBytes());
+    }
+
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/AxisRequestEntityImpl.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/AxisRequestEntityImpl.java
new file mode 100644
index 0000000..5be5a33
--- /dev/null
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/AxisRequestEntityImpl.java
@@ -0,0 +1,81 @@
+/*
+ * 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.axiom.om.OMOutputFormat;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.transport.http.AxisRequestEntity;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+import org.apache.http.message.BasicHeader;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * This Request Entity is used by the HttpComponentsTransportSender. This wraps the
+ * Axis2 message formatter object.
+ */
+public class AxisRequestEntityImpl extends AxisRequestEntity implements HttpEntity {
+
+    /**
+     * Method calls to this request entity are delegated to the following Axis2
+     * message formatter object.
+     *
+     * @param messageFormatter
+     * @param msgContext
+     * @param format
+     * @param soapAction
+     * @param chunked
+     * @param isAllowedRetry
+     */
+    public AxisRequestEntityImpl(MessageFormatter messageFormatter, MessageContext msgContext,
+            OMOutputFormat format, String soapAction, boolean chunked, boolean isAllowedRetry) {
+        super(messageFormatter, msgContext, format, soapAction, chunked, isAllowedRetry);
+    }
+
+    public Header getContentType() {
+        return new BasicHeader(HTTPConstants.HEADER_CONTENT_TYPE, getContentTypeAsString());
+    }
+
+    public Header getContentEncoding() {
+        return null;
+    }
+
+    public InputStream getContent() throws IOException {
+        return getRequestEntityContent();
+    }
+
+    public void writeTo(OutputStream outputStream) throws IOException {
+        writeRequest(outputStream);
+    }
+
+    public boolean isStreaming() {
+        return false;
+    }
+
+    public void consumeContent() {
+        // TODO: Handle this correctly
+    }
+
+}
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPTransportHeaders.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPTransportHeaders.java
new file mode 100644
index 0000000..ed6d058
--- /dev/null
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPTransportHeaders.java
@@ -0,0 +1,44 @@
+/*
+ * 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.transport.http.CommonsTransportHeaders;
+import org.apache.http.Header;
+
+import java.util.HashMap;
+
+
+public class HTTPTransportHeaders extends CommonsTransportHeaders {
+
+    private Header[] headers;
+
+    public HTTPTransportHeaders(Header[] headers) {
+        this.headers = headers;
+
+    }
+
+    protected void init() {
+        setHeaderMap(new HashMap());
+        for (int i = 0; i < headers.length; i++) {
+            getHeaderMap().put(headers[i].getName(), headers[i].getValue());
+        }
+    }
+
+}
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HttpTransportPropertiesImpl.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HttpTransportPropertiesImpl.java
new file mode 100644
index 0000000..dd34240
--- /dev/null
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HttpTransportPropertiesImpl.java
@@ -0,0 +1,93 @@
+/*
+ * 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.transport.http.HTTPAuthenticator;
+import org.apache.axis2.transport.http.HttpTransportProperties;
+import org.apache.http.HttpVersion;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.client.params.AuthPolicy;
+
+public class HttpTransportPropertiesImpl extends HttpTransportProperties {
+
+    protected HttpVersion httpVersion;
+
+    @Override
+    public void setHttpVersion(Object httpVerion) {
+        this.httpVersion = (HttpVersion) httpVerion;
+    }
+
+    @Override
+    public Object getHttpVersion() {
+        return this.httpVersion;
+    }
+
+    /*
+     * This class is responsible for holding all the necessary information
+     * needed for NTML, Digest, Basic and SPNEGO(Keberos) Authentication.
+     * Authentication itself is handled by httpclient. User doesn't need
+     * to worry about what authentication mechanism it uses. Axis2 uses
+     * httpclinet's default authentication patterns.
+     */
+    public static class Authenticator extends HTTPAuthenticator {
+
+        /* port of the host that needed to be authenticated with */
+        private int port = AuthScope.ANY_PORT;
+        /* Realm for authentication scope */
+        private String realm = AuthScope.ANY_REALM;
+        /* Default Auth Schems */
+        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;
+        }
+
+        public void setPort(int port) {
+            this.port = port;
+        }
+
+        public String getRealm() {
+            return realm;
+        }
+
+        public void setRealm(String realm) {
+            this.realm = realm;
+        }
+
+        @Override
+        public Object getAuthPolicyPref(String scheme) {
+            if (BASIC.equals(scheme)) {
+                return AuthPolicy.BASIC;
+            } else if (NTLM.equals(scheme)) {
+                return AuthPolicy.NTLM;
+            } else if (DIGEST.equals(scheme)) {
+                return AuthPolicy.DIGEST;
+            } else if (SPNEGO.equals(scheme)) {
+                return AuthPolicy.SPNEGO;
+            }
+            return null;
+        }
+
+    }
+
+}
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RESTRequestEntity2Impl.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RESTRequestEntity2Impl.java
new file mode 100644
index 0000000..634fa8a
--- /dev/null
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RESTRequestEntity2Impl.java
@@ -0,0 +1,65 @@
+/*
+ * 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.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.RESTRequestEntity2;
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+import org.apache.http.message.BasicHeader;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class RESTRequestEntity2Impl extends RESTRequestEntity2 implements HttpEntity{
+
+    public RESTRequestEntity2Impl(String postRequestBody, String contentType) {
+        super(postRequestBody, contentType);
+    }
+
+    public boolean isChunked() {
+        return false;
+    }
+
+    public Header getContentType() {
+        return new BasicHeader(HTTPConstants.HEADER_CONTENT_TYPE, getContentTypeAsString());
+    }
+
+    public Header getContentEncoding() {
+        return null;
+    }
+
+    public InputStream getContent() throws IOException{
+        return getRequestEntityContent();
+    }
+
+    public void writeTo(OutputStream outputStream) throws IOException {
+        writeRequest(outputStream);
+    }
+
+    public boolean isStreaming() {
+        return false;
+    }
+
+    public void consumeContent() {
+        //TODO : Handle this correctly
+    }
+}
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RESTRequestEntityImpl.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RESTRequestEntityImpl.java
new file mode 100644
index 0000000..1107ad8
--- /dev/null
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RESTRequestEntityImpl.java
@@ -0,0 +1,68 @@
+/*
+ * 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.axiom.om.OMElement;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.RESTRequestEntity;
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+import org.apache.http.message.BasicHeader;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class RESTRequestEntityImpl extends RESTRequestEntity implements HttpEntity {
+
+    public RESTRequestEntityImpl(OMElement element, boolean chunked, MessageContext msgCtxt,
+            String charSetEncoding, String soapActionString, OMOutputFormat format) {
+        super(element, chunked, msgCtxt, charSetEncoding, soapActionString, format);
+    }
+
+    public Header getContentType() {
+        return new BasicHeader(HTTPConstants.HEADER_CONTENT_TYPE, getContentTypeAsString());
+    }
+
+    public Header getContentEncoding() {
+        return null;
+    }
+
+    public InputStream getContent() throws AxisFault {
+        return new ByteArrayInputStream(writeBytes());
+    }
+
+    public void writeTo(OutputStream outputStream) throws IOException {
+        writeRequest(outputStream);
+    }
+
+    public boolean isStreaming() {
+        return false;
+    }
+
+    public void consumeContent() {
+        //TODO : Handle this correctly
+    }
+
+}


[axis-axis2-java-core] 07/15: AXIS2-4318 - Refactored test cases.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit 57f7acc6e7b8237fc71887620112939569f51dff
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Thu Mar 1 12:52:26 2012 +0000

    AXIS2-4318 - Refactored  test cases.
---
 .../CommonsHTTPTransportSenderClientSideTest.java  |  3 +-
 .../http/CommonsHTTPTransportSenderTest.java       | 17 +++--
 .../transport/http/HTTPClient3SenderTest.java      | 31 ++++++++
 .../http/HTTPClient3TransportSenderTest.java       | 32 ++++++++
 .../axis2/transport/http/HTTPSenderTest.java       | 85 ++++++++++++----------
 5 files changed, 122 insertions(+), 46 deletions(-)

diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderClientSideTest.java b/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderClientSideTest.java
index 658f5ca..671f49e 100644
--- a/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderClientSideTest.java
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderClientSideTest.java
@@ -11,6 +11,7 @@ import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.transport.OutTransportInfo;
+import org.apache.axis2.transport.http.impl.httpclient3.HTTPClient3TransportSender;
 import org.apache.axis2.transport.http.mock.MockAxisHttpResponse;
 import org.apache.axis2.transport.http.mock.MockHTTPResponse;
 import org.apache.axis2.transport.http.mock.server.AbstractHTTPServerTest;
@@ -31,7 +32,7 @@ public class CommonsHTTPTransportSenderClientSideTest extends AbstractHTTPServer
         // client hence ignore the processing of response at client side.
         try {
             httpResponse = (MockAxisHttpResponse) CommonsHTTPTransportSenderTest.configAndRun(
-                    httpResponse, (OutTransportInfo) httpResponse, "http://localhost:" + port);
+                    httpResponse, (OutTransportInfo) httpResponse, "http://localhost:" + port,  new HTTPClient3TransportSender());
 
         } catch (Exception e) {
         }
diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderTest.java b/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderTest.java
index ec07b69..e3820bd 100644
--- a/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderTest.java
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderTest.java
@@ -54,14 +54,16 @@ import org.apache.http.ProtocolVersion;
 import org.apache.http.RequestLine;
 import org.apache.http.message.BasicRequestLine;
 
-public class CommonsHTTPTransportSenderTest extends TestCase  {
+public abstract class CommonsHTTPTransportSenderTest extends TestCase  {
+    
+    protected abstract TransportSender getTransportSender();
 
     public void testInvokeWithServletBasedOutTransportInfo() throws Exception {
         MockHTTPResponse httpResponse = new MockHttpServletResponse();
         ServletBasedOutTransportInfo info = new ServletBasedOutTransportInfo(
                 (HttpServletResponse) httpResponse);
         SOAPEnvelope envelope = getEnvelope();
-        httpResponse = configAndRun(httpResponse, info, null);
+        httpResponse = configAndRun(httpResponse, info, null, getTransportSender());
 
         assertEquals("Not the expected Header value", "application/xml", httpResponse.getHeaders()
                 .get("Content-Type"));
@@ -76,7 +78,7 @@ public class CommonsHTTPTransportSenderTest extends TestCase  {
         MockHTTPResponse httpResponse = new MockAxisHttpResponse(line);
         SOAPEnvelope envelope = getEnvelope();
         httpResponse = (MockAxisHttpResponse) configAndRun(httpResponse,
-                (OutTransportInfo) httpResponse, null);
+                (OutTransportInfo) httpResponse, null, getTransportSender());
 
         assertEquals("Not the expected Header value", "application/xml", httpResponse.getHeaders()
                 .get("Content-Type"));
@@ -87,7 +89,7 @@ public class CommonsHTTPTransportSenderTest extends TestCase  {
     }
 
     public void testCleanup() throws AxisFault {
-        TransportSender sender = new CommonsHTTPTransportSender();
+        TransportSender sender = getTransportSender();
         MessageContext msgContext = new MessageContext();
         HttpMethod httpMethod = new GetMethod();
         msgContext.setProperty(HTTPConstants.HTTP_METHOD, httpMethod);
@@ -102,13 +104,13 @@ public class CommonsHTTPTransportSenderTest extends TestCase  {
         ConfigurationContext confContext = ConfigurationContextFactory
                 .createEmptyConfigurationContext();
         TransportOutDescription transportOut = new TransportOutDescription("http");
-        TransportSender sender = new CommonsHTTPTransportSender();
+        TransportSender sender = getTransportSender();
         sender.init(confContext, transportOut);
 
     }
 
     public static MockHTTPResponse configAndRun(MockHTTPResponse outResponse,
-            OutTransportInfo outTransportInfo, String epr) throws Exception {
+            OutTransportInfo outTransportInfo, String epr, TransportSender sender) throws Exception {
         MockHTTPResponse response = outResponse;
         ConfigurationContext confContext = ConfigurationContextFactory
                 .createEmptyConfigurationContext();
@@ -116,8 +118,7 @@ public class CommonsHTTPTransportSenderTest extends TestCase  {
         Parameter param = new Parameter(HTTPConstants.OMIT_SOAP_12_ACTION, false);
         SOAPEnvelope envelope = getEnvelope();
         MessageContext msgContext = new MessageContext();
-
-        TransportSender sender = new CommonsHTTPTransportSender();
+        
         transportOut.addParameter(param);
         // create dummy SOAPEnvelope
         msgContext.setEnvelope(envelope);
diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient3SenderTest.java b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient3SenderTest.java
new file mode 100644
index 0000000..dff8b6f
--- /dev/null
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient3SenderTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.transport.http.impl.httpclient3.HTTPSenderImpl;
+
+public class HTTPClient3SenderTest extends HTTPSenderTest {
+
+    @Override
+    protected HTTPSender getHTTPSender() {
+        return new HTTPSenderImpl();
+    }
+
+}
diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient3TransportSenderTest.java b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient3TransportSenderTest.java
new file mode 100644
index 0000000..058b62b
--- /dev/null
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient3TransportSenderTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.transport.TransportSender;
+import org.apache.axis2.transport.http.impl.httpclient3.HTTPClient3TransportSender;
+
+public class HTTPClient3TransportSenderTest extends CommonsHTTPTransportSenderTest {
+
+    @Override
+    protected TransportSender getTransportSender() {
+        return new HTTPClient3TransportSender();
+    }
+
+}
diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
index ad7d9d0..dd77c51 100644
--- a/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
@@ -35,48 +35,56 @@ import org.apache.axis2.transport.http.mock.server.AbstractHTTPServerTest;
 /**
  * The Class HTTPSenderTest.
  */
-public class HTTPSenderTest extends AbstractHTTPServerTest {
-   
+public abstract class HTTPSenderTest extends AbstractHTTPServerTest {
+
     private HTTPSender httpSender;
 
+    protected abstract HTTPSender getHTTPSender();
+
     /**
      * Send via http.
-     *
-     * @param httpMethod the http method
-     * @param soapAction the soap action
-     * @param address the address
-     * @param rest the rest
-     * @throws IOException Signals that an I/O exception has occurred.
-     * @throws MessagingException the messaging exception
+     * 
+     * @param httpMethod
+     *            the http method
+     * @param soapAction
+     *            the soap action
+     * @param address
+     *            the address
+     * @param rest
+     *            the rest
+     * @throws IOException
+     *             Signals that an I/O exception has occurred.
+     * @throws MessagingException
+     *             the messaging exception
      */
     private void sendViaHTTP(String httpMethod, String soapAction, String address, boolean rest)
             throws IOException, MessagingException {
-        httpSender = new HTTPSender();
+        httpSender = getHTTPSender();
         MessageContext msgContext = new MessageContext();
         ConfigurationContext configContext = ConfigurationContextFactory
                 .createEmptyConfigurationContext();
         OperationContext opContext = new OperationContext();
-        
+
         msgContext.setConfigurationContext(configContext);
         msgContext.setEnvelope(getEnvelope());
         msgContext.setDoingREST(rest);
-        msgContext.setProperty(Constants.Configuration.HTTP_METHOD, httpMethod);      
-        msgContext.setOperationContext(opContext );
-        URL url = new URL(address);        
+        msgContext.setProperty(Constants.Configuration.HTTP_METHOD, httpMethod);
+        msgContext.setOperationContext(opContext);
+        URL url = new URL(address);
         httpSender.send(msgContext, url, soapAction);
-       
 
     }
 
     /**
      * Test send via get.
-     *
-     * @throws Exception the exception
+     * 
+     * @throws Exception
+     *             the exception
      */
     public void testSendViaGet() throws Exception {
         int port = getBasicHttpServer().getPort();
-        sendViaHTTP(Constants.Configuration.HTTP_METHOD_GET, "urn:getService",
-                "http://localhost:" + port + "/getService", true);
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_GET, "urn:getService", "http://localhost:"
+                + port + "/getService", true);
         assertEquals("Not the expected HTTP Method", Constants.Configuration.HTTP_METHOD_GET,
                 getHTTPMethod());
         assertEquals("Not the expected content", "/getService?part=sample%20data",
@@ -91,11 +99,12 @@ public class HTTPSenderTest extends AbstractHTTPServerTest {
         assertEquals("Not the expected HTTP Header value", "Axis2",
                 getHeaders().get(HttpHeaders.USER_AGENT));
     }
-    
+
     /**
      * Test send via post.
-     *
-     * @throws Exception the exception
+     * 
+     * @throws Exception
+     *             the exception
      */
     public void testSendViaPost() throws Exception {
         // test with REST payload
@@ -133,14 +142,15 @@ public class HTTPSenderTest extends AbstractHTTPServerTest {
 
     /**
      * Test send via put.
-     *
-     * @throws Exception the exception
+     * 
+     * @throws Exception
+     *             the exception
      */
     public void testSendViaPut() throws Exception {
         // test with REST payload
         int port = getBasicHttpServer().getPort();
-        sendViaHTTP(Constants.Configuration.HTTP_METHOD_PUT, "urn:putService",
-                "http://localhost:" + port + "/putService", true);
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_PUT, "urn:putService", "http://localhost:"
+                + port + "/putService", true);
         assertEquals("Not the expected HTTP Method", Constants.Configuration.HTTP_METHOD_PUT,
                 getHTTPMethod());
         assertEquals("Not the expected content", getEnvelope().getFirstElement().getFirstElement()
@@ -155,8 +165,8 @@ public class HTTPSenderTest extends AbstractHTTPServerTest {
                 getHeaders().get(HttpHeaders.USER_AGENT));
 
         // test with SOAP payload.
-        sendViaHTTP(Constants.Configuration.HTTP_METHOD_PUT, "urn:putService",
-                "http://localhost:" + port + "/putService", false);
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_PUT, "urn:putService", "http://localhost:"
+                + port + "/putService", false);
         assertEquals("Not the expected HTTP Method", Constants.Configuration.HTTP_METHOD_PUT,
                 getHTTPMethod());
         assertEquals("Not the expected content", getEnvelope().toString(), getStringContent());
@@ -172,8 +182,9 @@ public class HTTPSenderTest extends AbstractHTTPServerTest {
 
     /**
      * Test send via delete.
-     *
-     * @throws Exception the exception
+     * 
+     * @throws Exception
+     *             the exception
      */
     public void testSendViaDelete() throws Exception {
         // test with REST payload
@@ -196,8 +207,9 @@ public class HTTPSenderTest extends AbstractHTTPServerTest {
 
     /**
      * Test send via head.
-     *
-     * @throws Exception the exception
+     * 
+     * @throws Exception
+     *             the exception
      */
     public void testSendViaHead() throws Exception {
 
@@ -219,8 +231,9 @@ public class HTTPSenderTest extends AbstractHTTPServerTest {
 
     /**
      * Test send nohttp method.
-     *
-     * @throws Exception the exception
+     * 
+     * @throws Exception
+     *             the exception
      */
     public void testSendNOHTTPMethod() throws Exception {
 
@@ -239,8 +252,6 @@ public class HTTPSenderTest extends AbstractHTTPServerTest {
         assertEquals("Not the expected HTTP Header value", "Axis2",
                 getHeaders().get(HttpHeaders.USER_AGENT));
 
-    }   
-    
+    }
 
-   
 }


[axis-axis2-java-core] 14/15: Deprecated HTTPProxcyConfigurator class.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit 7f5ed0b7e6094ca24b0534e4966e50102a3bb97b
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Tue May 8 06:58:53 2012 +0000

    Deprecated HTTPProxcyConfigurator class.
---
 .../axis2/transport/http/impl/httpclient3/HTTPProxcyConfigurator.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPProxcyConfigurator.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPProxcyConfigurator.java
index 670e9e1..64bd9e7 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPProxcyConfigurator.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPProxcyConfigurator.java
@@ -41,6 +41,10 @@ import org.apache.commons.httpclient.auth.AuthScope;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+/**
+ * @deprecated  use {@link HTTPProxyConfigurator}
+ */
+@Deprecated
 public class HTTPProxcyConfigurator {
 
     private static Log log = LogFactory.getLog(HTTPProxcyConfigurator.class);


[axis-axis2-java-core] 09/15: Merged r1324778 to the AXIS2-4318 branch.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit 10997203f96395ea5b9e8ce4643b6d3c2c0e80aa
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Wed Apr 11 14:45:06 2012 +0000

    Merged r1324778 to the AXIS2-4318 branch.
---
 .../apache/axis2/transport/http/HTTPSender.java    | 35 ++++++++++++-
 .../http/impl/httpclient3/HTTPSenderImpl.java      | 26 ++++-----
 .../axis2/transport/http/HTTPSenderTest.java       | 41 +++++++++++++++
 .../http/mock/server/BasicHttpServer.java          |  6 +++
 .../http/mock/server/BasicHttpServerImpl.java      | 61 +++++++++++++++++++++-
 5 files changed, 151 insertions(+), 18 deletions(-)

diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java b/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java
index 118ffbf..5cce62c 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java
@@ -121,6 +121,37 @@ public abstract class HTTPSender extends AbstractHTTPSender {
         }
 
         this.sendViaPost(msgContext, url, soapActionString);
-    }    
-       
+    }   
+
+    /**
+     * Used to determine the family of HTTP status codes to which the given code
+     * belongs.
+     * 
+     * @param statusCode
+     *            - The HTTP status code
+     */
+    protected HTTPStatusCodeFamily getHTTPStatusCodeFamily(int statusCode) {
+        switch (statusCode / 100) {
+        case 1:
+            return HTTPStatusCodeFamily.INFORMATIONAL;
+        case 2:
+            return HTTPStatusCodeFamily.SUCCESSFUL;
+        case 3:
+            return HTTPStatusCodeFamily.REDIRECTION;
+        case 4:
+            return HTTPStatusCodeFamily.CLIENT_ERROR;
+        case 5:
+            return HTTPStatusCodeFamily.SERVER_ERROR;
+        default:
+            return HTTPStatusCodeFamily.OTHER;
+        }
+    }
+
+    /**
+     * The set of HTTP status code families.
+     */
+    protected enum HTTPStatusCodeFamily {
+        INFORMATIONAL, SUCCESSFUL, REDIRECTION, CLIENT_ERROR, SERVER_ERROR, OTHER
+    }
+
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
index 4c5d7b8..2c09c35 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
@@ -296,23 +296,19 @@ public class HTTPSenderImpl extends HTTPSender {
             return;
         }
         int statusCode = method.getStatusCode();
+        HTTPStatusCodeFamily family = getHTTPStatusCodeFamily(statusCode);
         log.trace("Handling response - " + statusCode);
-        if (statusCode == HttpStatus.SC_OK) {
-            // Save the HttpMethod so that we can release the connection when
-            // cleaning up
-            msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
-            processResponse(method, msgContext);
-        } else if (statusCode == HttpStatus.SC_ACCEPTED) {
-            /*
-             * When an HTTP 202 Accepted code has been received, this will be
-             * the case of an execution of an in-only operation. In such a
-             * scenario, the HTTP response headers should be returned, i.e.
-             * session cookies.
-             */
+        if (statusCode == HttpStatus.SC_ACCEPTED) {
+            /* When an HTTP 202 Accepted code has been received, this will be the case of an execution 
+             * of an in-only operation. In such a scenario, the HTTP response headers should be returned,
+             * i.e. session cookies. */
             obtainHTTPHeaderInformation(method, msgContext);
-            // Since we don't expect any content with a 202 response, we must
-            // release the connection
-            method.releaseConnection();
+            // Since we don't expect any content with a 202 response, we must release the connection
+            method.releaseConnection();            
+        } else if (HTTPStatusCodeFamily.SUCCESSFUL.equals(family)) {
+            // Save the HttpMethod so that we can release the connection when cleaning up
+            msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
+            processResponse(method, msgContext);            
         } else if (statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR
                 || statusCode == HttpStatus.SC_BAD_REQUEST) {
             // Save the HttpMethod so that we can release the connection when
diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
index dd77c51..d51b28d 100644
--- a/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
@@ -31,6 +31,7 @@ import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.transport.http.mock.server.AbstractHTTPServerTest;
+import org.apache.axis2.transport.http.mock.server.BasicHttpServer;
 
 /**
  * The Class HTTPSenderTest.
@@ -253,5 +254,45 @@ public abstract class HTTPSenderTest extends AbstractHTTPServerTest {
                 getHeaders().get(HttpHeaders.USER_AGENT));
 
     }
+    public void testHandleResponseHTTPStatusCode200() throws Exception {
+        httpSender = getHTTPSender();
+        int port = getBasicHttpServer().getPort();
+        getBasicHttpServer().setResponseTemplate(BasicHttpServer.RESPONSE_HTTP_200);
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_POST, "urn:postService",
+                "http://localhost:" + port + "/postService", true);
+    }
+    
+    public void testHandleResponseHTTPStatusCode201() throws Exception {
+        httpSender = getHTTPSender();
+        int port = getBasicHttpServer().getPort();
+        getBasicHttpServer().setResponseTemplate(BasicHttpServer.RESPONSE_HTTP_201);
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_POST, "urn:postService",
+                "http://localhost:" + port + "/postService", true);
+    }
+    
+    public void testHandleResponseHTTPStatusCode202() throws Exception {
+        httpSender = getHTTPSender();
+        int port = getBasicHttpServer().getPort();
+        getBasicHttpServer().setResponseTemplate(BasicHttpServer.RESPONSE_HTTP_202);
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_POST, "urn:postService",
+                "http://localhost:" + port + "/postService", true);
+    }
+    
+    public void testHandleResponseHTTPStatusCode400() throws Exception {
+        httpSender = getHTTPSender();
+        int port = getBasicHttpServer().getPort();
+        getBasicHttpServer().setResponseTemplate(BasicHttpServer.RESPONSE_HTTP_400);
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_POST, "urn:postService",
+                "http://localhost:" + port + "/postService", true);
+    }
+    
+    public void testHandleResponseHTTPStatusCode500() throws Exception {
+        httpSender = getHTTPSender();
+        int port = getBasicHttpServer().getPort();
+        getBasicHttpServer().setResponseTemplate(BasicHttpServer.RESPONSE_HTTP_500);
+        sendViaHTTP(Constants.Configuration.HTTP_METHOD_POST, "urn:postService",
+                "http://localhost:" + port + "/postService", true);
+    }
+    
 
 }
diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/mock/server/BasicHttpServer.java b/modules/transport/http/test/org/apache/axis2/transport/http/mock/server/BasicHttpServer.java
index 211525a..aa20c74 100644
--- a/modules/transport/http/test/org/apache/axis2/transport/http/mock/server/BasicHttpServer.java
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/mock/server/BasicHttpServer.java
@@ -148,5 +148,11 @@ public interface BasicHttpServer {
     public static final String RESPONSE_HTTP_404 = "response.http.404";
     public static final String RESPONSE_HTTP_OK_XML = "response.http.ok.xml";
     public static final String RESPONSE_HTTP_OK_LOOP_BACK = "response.http.ok.loop.back";
+    public static final String RESPONSE_HTTP_200 = "response.http.200";
+    public static final String RESPONSE_HTTP_201 = "response.http.201";
+    public static final String RESPONSE_HTTP_202 = "response.http.202";
+    public static final String RESPONSE_HTTP_400 = "response.http.400";
+    public static final String RESPONSE_HTTP_500 = "response.http.500";
+
 
 }
diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/mock/server/BasicHttpServerImpl.java b/modules/transport/http/test/org/apache/axis2/transport/http/mock/server/BasicHttpServerImpl.java
index 4ef79b1..a93e670 100644
--- a/modules/transport/http/test/org/apache/axis2/transport/http/mock/server/BasicHttpServerImpl.java
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/mock/server/BasicHttpServerImpl.java
@@ -238,7 +238,66 @@ public class BasicHttpServerImpl implements BasicHttpServer {
                     }
 
                 });
-            }
+                
+            } else if (server.getResponseTemplate().equals(BasicHttpServer.RESPONSE_HTTP_200)) {
+                response.setStatusCode(HttpStatus.SC_OK);
+                body = new EntityTemplate(new ContentProducer() {
+
+                    public void writeTo(final OutputStream outstream) throws IOException {
+                        OutputStreamWriter writer = new OutputStreamWriter(outstream, "UTF-8");
+                        writer.write("<Response> SC_ACCEPTED 202 <Response>");
+                        writer.flush();
+                    }
+
+                });
+                
+            } else if (server.getResponseTemplate().equals(BasicHttpServer.RESPONSE_HTTP_201)) {
+                response.setStatusCode(HttpStatus.SC_CREATED);
+                body = new EntityTemplate(new ContentProducer() {
+
+                    public void writeTo(final OutputStream outstream) throws IOException {
+                        OutputStreamWriter writer = new OutputStreamWriter(outstream, "UTF-8");
+                        //writer.write("<Response> SC_ACCEPTED 202 <Response>");
+                        writer.flush();
+                    }
+
+                });
+                
+            } else if (server.getResponseTemplate().equals(BasicHttpServer.RESPONSE_HTTP_202)) {
+                response.setStatusCode(HttpStatus.SC_ACCEPTED);
+                body = new EntityTemplate(new ContentProducer() {
+                    public void writeTo(final OutputStream outstream) throws IOException {
+                        OutputStreamWriter writer = new OutputStreamWriter(outstream, "UTF-8");
+                        //writer.write("<Response> SC_ACCEPTED 202 <Response>");
+                        writer.flush();
+                    }
+
+                });
+                
+            } else if (server.getResponseTemplate().equals(BasicHttpServer.RESPONSE_HTTP_400)) {
+                response.setStatusCode(HttpStatus.SC_BAD_REQUEST);
+                body = new EntityTemplate(new ContentProducer() {
+                    public void writeTo(final OutputStream outstream) throws IOException {
+                        OutputStreamWriter writer = new OutputStreamWriter(outstream, "UTF-8");
+                        //writer.write("<Response> SC_ACCEPTED 202 <Response>");
+                        writer.flush();
+                    }
+
+                });
+                
+            } else if (server.getResponseTemplate().equals(BasicHttpServer.RESPONSE_HTTP_500)) {
+                response.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+                body = new EntityTemplate(new ContentProducer() {
+                    public void writeTo(final OutputStream outstream) throws IOException {
+                        OutputStreamWriter writer = new OutputStreamWriter(outstream, "UTF-8");
+                        writer.write(" Server Error");
+                        writer.flush();
+                    }
+
+                });
+                
+            }            
+            
             // TODO - customize to send content type depend on expectations.
             body.setContentType("text/html; charset=UTF-8");
             response.setEntity(body);


[axis-axis2-java-core] 13/15: Applied latest patch.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit 5cbc2cb75692fce5497e998e1d681861c85a1a29
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Tue May 8 06:52:55 2012 +0000

    Applied latest patch.
---
 .../HTTPProxyConfigurator.java                     | 67 +++++++++++-----------
 .../http/impl/httpclient3/HTTPSenderImpl.java      |  4 +-
 .../impl/httpclient4/HTTPProxyConfigurator.java    |  5 +-
 3 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPProxyConfigurator.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPProxyConfigurator.java
similarity index 92%
copy from modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPProxyConfigurator.java
copy to modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPProxyConfigurator.java
index 67615f4..e47f4f4 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPProxyConfigurator.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPProxyConfigurator.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.axis2.transport.http.impl.httpclient4;
+package org.apache.axis2.transport.http.impl.httpclient3;
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
@@ -26,22 +26,20 @@ import org.apache.axis2.description.Parameter;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.transport.http.HTTPTransportConstants;
 import org.apache.axis2.transport.http.HttpTransportProperties;
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.HostConfiguration;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.NTCredentials;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.http.HttpHost;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.Credentials;
-import org.apache.http.auth.NTCredentials;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.http.client.params.ClientPNames;
-import org.apache.http.conn.params.ConnRoutePNames;
-import org.apache.http.impl.client.AbstractHttpClient;
 
 import javax.xml.namespace.QName;
 import java.net.URL;
 import java.util.StringTokenizer;
 
-
 public class HTTPProxyConfigurator {
 
     private static Log log = LogFactory.getLog(HTTPProxyConfigurator.class);
@@ -55,16 +53,18 @@ public class HTTPProxyConfigurator {
      * <Configuration> <ProxyHost>example.org</ProxyHost>
      * <ProxyPort>3128</ProxyPort> <ProxyUser>EXAMPLE/John</ProxyUser>
      * <ProxyPassword>password</ProxyPassword> <Configuration> <parameter>
-     *
+     * 
      * @param messageContext
      *            in message context for
      * @param httpClient
-     *            instance
-     * @throws org.apache.axis2.AxisFault
+     *            commons-httpclient instance
+     * @param config
+     *            commons-httpclient HostConfiguration
+     * @throws AxisFault
      *             if Proxy settings are invalid
      */
-    public static void configure(MessageContext messageContext, AbstractHttpClient httpClient)
-            throws AxisFault {
+    public static void configure(MessageContext messageContext, HttpClient httpClient,
+            HostConfiguration config) throws AxisFault {
 
         Credentials proxyCredentials = null;
         String proxyHost = null;
@@ -77,8 +77,7 @@ public class HTTPProxyConfigurator {
         Parameter proxySettingsFromAxisConfig = messageContext.getConfigurationContext()
                 .getAxisConfiguration().getParameter(HTTPTransportConstants.ATTR_PROXY);
         if (proxySettingsFromAxisConfig != null) {
-            OMElement proxyConfiguration =
-                    getProxyConfigurationElement(proxySettingsFromAxisConfig);
+            OMElement proxyConfiguration = getProxyConfigurationElement(proxySettingsFromAxisConfig);
             proxyHost = getProxyHost(proxyConfiguration);
             proxyPort = getProxyPort(proxyConfiguration);
             proxyUser = getProxyUser(proxyConfiguration);
@@ -87,24 +86,25 @@ public class HTTPProxyConfigurator {
                 if (proxyPassword == null) {
                     proxyPassword = "";
                 }
+
+                proxyCredentials = new UsernamePasswordCredentials(proxyUser, proxyPassword);
+
                 int proxyUserDomainIndex = proxyUser.indexOf("\\");
                 if (proxyUserDomainIndex > 0) {
                     String domain = proxyUser.substring(0, proxyUserDomainIndex);
                     if (proxyUser.length() > proxyUserDomainIndex + 1) {
                         String user = proxyUser.substring(proxyUserDomainIndex + 1);
-                        proxyCredentials = new NTCredentials(user, proxyPassword, proxyHost,
-                                                             domain);
+                        proxyCredentials = new NTCredentials(user, proxyPassword, proxyHost, domain);
                     }
                 }
-                proxyCredentials = new UsernamePasswordCredentials(proxyUser, proxyPassword);
+
             }
 
         }
 
         // If there is runtime proxy settings, these settings will override
         // settings from axis2.xml
-        HttpTransportProperties.ProxyProperties proxyProperties =
-                (HttpTransportProperties.ProxyProperties) messageContext
+        HttpTransportProperties.ProxyProperties proxyProperties = (HttpTransportProperties.ProxyProperties) messageContext
                 .getProperty(HTTPConstants.PROXY);
         if (proxyProperties != null) {
             String proxyHostProp = proxyProperties.getProxyHostName();
@@ -140,14 +140,15 @@ public class HTTPProxyConfigurator {
         }
 
         if (proxyCredentials != null) {
-            // TODO : Set preemptive authentication, but its not recommended in HC 4
-            httpClient.getParams().setParameter(ClientPNames.HANDLE_AUTHENTICATION, true);
-
-            httpClient.getCredentialsProvider().setCredentials(AuthScope.ANY, proxyCredentials);
-            HttpHost proxy = new HttpHost(proxyHost, proxyPort);
-            httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
-
+            httpClient.getParams().setAuthenticationPreemptive(true);
+            HttpState cachedHttpState = (HttpState) messageContext
+                    .getProperty(HTTPConstants.CACHED_HTTP_STATE);
+            if (cachedHttpState != null) {
+                httpClient.setState(cachedHttpState);
+            }
+            httpClient.getState().setProxyCredentials(AuthScope.ANY, proxyCredentials);
         }
+        config.setProxy(proxyHost, proxyPort);
     }
 
     private static OMElement getProxyConfigurationElement(Parameter proxySettingsFromAxisConfig)
@@ -224,7 +225,7 @@ public class HTTPProxyConfigurator {
     /**
      * Check whether http proxy is configured or active. This is not a deep
      * check.
-     *
+     * 
      * @param messageContext
      *            in message context
      * @param targetURL
@@ -266,7 +267,7 @@ public class HTTPProxyConfigurator {
      * <p/>
      * false : validation fail : User can use the proxy true : validation pass ;
      * User can't use the proxy
-     *
+     * 
      * @return boolean
      */
     private static boolean validateNonProxyHosts(String host) {
@@ -277,7 +278,7 @@ public class HTTPProxyConfigurator {
 
     /**
      * Check if the specified host is in the list of non proxy hosts.
-     *
+     * 
      * @param host
      *            host name
      * @param nonProxyHosts
@@ -307,7 +308,7 @@ public class HTTPProxyConfigurator {
     /**
      * Matches a string against a pattern. The pattern contains two special
      * characters: '*' which means zero or more characters,
-     *
+     * 
      * @param pattern
      *            the (non-null) pattern to match against
      * @param str
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
index 2c09c35..566db64 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
@@ -538,11 +538,11 @@ public class HTTPSenderImpl extends HTTPSender {
         }
         // proxy configuration
 
-        if (HTTPProxcyConfigurator.isProxyEnabled(msgCtx, targetURL)) {
+        if (HTTPProxyConfigurator.isProxyEnabled(msgCtx, targetURL)) {
             if (log.isDebugEnabled()) {
                 log.debug("Configuring HTTP proxy.");
             }
-            HTTPProxcyConfigurator.configure(msgCtx, client, config);
+            HTTPProxyConfigurator.configure(msgCtx, client, config);
         }
 
         return config;
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPProxyConfigurator.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPProxyConfigurator.java
index 67615f4..df7587e 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPProxyConfigurator.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPProxyConfigurator.java
@@ -87,6 +87,9 @@ public class HTTPProxyConfigurator {
                 if (proxyPassword == null) {
                     proxyPassword = "";
                 }
+
+                proxyCredentials = new UsernamePasswordCredentials(proxyUser, proxyPassword);
+
                 int proxyUserDomainIndex = proxyUser.indexOf("\\");
                 if (proxyUserDomainIndex > 0) {
                     String domain = proxyUser.substring(0, proxyUserDomainIndex);
@@ -96,9 +99,7 @@ public class HTTPProxyConfigurator {
                                                              domain);
                     }
                 }
-                proxyCredentials = new UsernamePasswordCredentials(proxyUser, proxyPassword);
             }
-
         }
 
         // If there is runtime proxy settings, these settings will override


[axis-axis2-java-core] 01/15: [maven-release-plugin] copy for branch AXIS2-4318

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit 130131b465bb5331c9d78503a207ecb31c7473e6
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Thu Jan 12 05:54:47 2012 +0000

    [maven-release-plugin]  copy for branch AXIS2-4318
---
 modules/adb-codegen/pom.xml                        |   6 +-
 modules/adb/pom.xml                                |   6 +-
 modules/addressing/pom.xml                         |   6 +-
 modules/clustering/pom.xml                         |   6 +-
 modules/codegen/pom.xml                            |   6 +-
 modules/corba/pom.xml                              |   6 +-
 modules/fastinfoset/pom.xml                        |   6 +-
 modules/integration/pom.xml                        |   6 +-
 modules/java2wsdl/pom.xml                          |   6 +-
 modules/jaxbri/pom.xml                             |   6 +-
 modules/jaxws-integration/pom.xml                  |   6 +-
 modules/jaxws-mar/pom.xml                          |   6 +-
 modules/jaxws/pom.xml                              |   6 +-
 .../controller/impl/AxisInvocationController.java  |  29 +-
 modules/jibx/pom.xml                               |   6 +-
 modules/json/pom.xml                               |   6 +-
 modules/kernel/pom.xml                             |   6 +-
 modules/metadata/pom.xml                           |   6 +-
 modules/mex/pom.xml                                |   6 +-
 modules/mtompolicy-mar/pom.xml                     |   6 +-
 modules/mtompolicy/pom.xml                         |   6 +-
 modules/osgi/pom.xml                               |   7 +-
 modules/parent/pom.xml                             |   6 +-
 modules/ping/pom.xml                               |   6 +-
 modules/resource-bundle/pom.xml                    |   6 +-
 modules/saaj/pom.xml                               |   6 +-
 modules/samples/version/pom.xml                    |   6 +-
 modules/scripting/pom.xml                          |   6 +-
 modules/soapmonitor/module/pom.xml                 |   6 +-
 modules/soapmonitor/servlet/pom.xml                |   6 +-
 modules/spring/pom.xml                             |   6 +-
 modules/testutils/pom.xml                          |   6 +-
 modules/tool/archetype/quickstart-webapp/pom.xml   |   3 +-
 modules/tool/archetype/quickstart/pom.xml          |   3 +-
 modules/tool/axis2-aar-maven-plugin/pom.xml        |   6 +-
 modules/tool/axis2-ant-plugin/pom.xml              |   6 +-
 modules/tool/axis2-eclipse-codegen-plugin/pom.xml  |   6 +-
 modules/tool/axis2-eclipse-service-plugin/pom.xml  |   6 +-
 modules/tool/axis2-idea-plugin/pom.xml             |   6 +-
 modules/tool/axis2-java2wsdl-maven-plugin/pom.xml  |   6 +-
 modules/tool/axis2-mar-maven-plugin/pom.xml        |   6 +-
 modules/tool/axis2-repo-maven-plugin/pom.xml       |   6 +-
 modules/tool/axis2-wsdl2code-maven-plugin/pom.xml  |   6 +-
 modules/tool/simple-server-maven-plugin/pom.xml    |   9 +-
 modules/transport/http/pom.xml                     |  17 +-
 .../axis2/transport/http/AbstractHTTPSender.java   | 689 +--------------------
 .../axis2/transport/http/AxisRequestEntity.java    |  15 +-
 .../apache/axis2/transport/http/AxisServlet.java   |  20 +-
 .../transport/http/CommonsHTTPTransportSender.java |  39 +-
 .../transport/http/CommonsTransportHeaders.java    |  30 +-
 .../apache/axis2/transport/http/HTTPSender.java    | 281 ++-------
 .../transport/http/HttpTransportProperties.java    | 136 +---
 .../axis2/transport/http/RESTRequestEntity.java    |  62 +-
 .../axis2/transport/http/RESTRequestEntity2.java   |  20 +-
 .../http/util/HTTPProxyConfigurationUtil.java      |   1 +
 .../CommonsHTTPTransportSenderClientSideTest.java  |   3 +-
 .../http/CommonsHTTPTransportSenderTest.java       |  17 +-
 .../axis2/transport/http/HTTPSenderTest.java       |   8 +-
 modules/transport/local/pom.xml                    |   6 +-
 modules/webapp/pom.xml                             |   6 +-
 modules/xmlbeans/pom.xml                           |   6 +-
 pom.xml                                            |   6 +-
 62 files changed, 408 insertions(+), 1239 deletions(-)

diff --git a/modules/adb-codegen/pom.xml b/modules/adb-codegen/pom.xml
index e97cd53..21ff501 100644
--- a/modules/adb-codegen/pom.xml
+++ b/modules/adb-codegen/pom.xml
@@ -62,9 +62,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/adb-codegen</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/adb-codegen</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-codegen</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/adb-codegen</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/adb-codegen</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/adb-codegen</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/adb/pom.xml b/modules/adb/pom.xml
index 51abb95..8c98adc 100644
--- a/modules/adb/pom.xml
+++ b/modules/adb/pom.xml
@@ -33,9 +33,9 @@
     <description>Axis2 Data Binding module</description>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/adb</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/adb</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/adb</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/adb</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/adb</url>
     </scm>
     <dependencies>
         <dependency>
diff --git a/modules/addressing/pom.xml b/modules/addressing/pom.xml
index de5b112..fddb1dd 100644
--- a/modules/addressing/pom.xml
+++ b/modules/addressing/pom.xml
@@ -45,9 +45,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/addressing</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/addressing</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/addressing</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/addressing</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/addressing</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/addressing</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/clustering/pom.xml b/modules/clustering/pom.xml
index 4841857..835ded5 100644
--- a/modules/clustering/pom.xml
+++ b/modules/clustering/pom.xml
@@ -65,9 +65,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/clustering</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/clustering</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/clustering</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/clustering</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/clustering</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/clustering</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/codegen/pom.xml b/modules/codegen/pom.xml
index 530eda2..ebdf3af 100644
--- a/modules/codegen/pom.xml
+++ b/modules/codegen/pom.xml
@@ -80,9 +80,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/codegen</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/codegen</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/codegen</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/codegen</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/codegen</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/corba/pom.xml b/modules/corba/pom.xml
index e078b37..6dd0e0a 100644
--- a/modules/corba/pom.xml
+++ b/modules/corba/pom.xml
@@ -58,9 +58,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/corba</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/corba</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/corba</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/corba</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/corba</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/corba</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/fastinfoset/pom.xml b/modules/fastinfoset/pom.xml
index a19d773..f87f307 100644
--- a/modules/fastinfoset/pom.xml
+++ b/modules/fastinfoset/pom.xml
@@ -107,9 +107,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/fastinfoset</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/fastinfoset</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/fastinfoset</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/fastinfoset</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/fastinfoset</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/fastinfoset</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/integration/pom.xml b/modules/integration/pom.xml
index a1b6782..e532bc5 100644
--- a/modules/integration/pom.xml
+++ b/modules/integration/pom.xml
@@ -286,9 +286,9 @@
     </profiles>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/integration</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/integration</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/integration</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/integration</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/integration</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/java2wsdl/pom.xml b/modules/java2wsdl/pom.xml
index 2cdda07..7e34442 100644
--- a/modules/java2wsdl/pom.xml
+++ b/modules/java2wsdl/pom.xml
@@ -104,9 +104,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/java2wsdl</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/java2wsdl</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/java2wsdl</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/java2wsdl</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/java2wsdl</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/java2wsdl</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/jaxbri/pom.xml b/modules/jaxbri/pom.xml
index 72d0f16..5b561d8 100644
--- a/modules/jaxbri/pom.xml
+++ b/modules/jaxbri/pom.xml
@@ -66,9 +66,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/jaxbri</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/jaxbri</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxbri</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxbri</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxbri</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxbri</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/jaxws-integration/pom.xml b/modules/jaxws-integration/pom.xml
index f3ba3ee..362e412 100644
--- a/modules/jaxws-integration/pom.xml
+++ b/modules/jaxws-integration/pom.xml
@@ -94,9 +94,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/jaxws-integration</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/jaxws-integration</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxws-integration</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxws-integration</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxws-integration</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/jaxws-mar/pom.xml b/modules/jaxws-mar/pom.xml
index 2803d22..7b791fa 100644
--- a/modules/jaxws-mar/pom.xml
+++ b/modules/jaxws-mar/pom.xml
@@ -42,9 +42,9 @@
 
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/jaxws-mar</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/jaxws-mar</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-mar</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxws-mar</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxws-mar</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxws-mar</url>
     </scm>
     
     <build>
diff --git a/modules/jaxws/pom.xml b/modules/jaxws/pom.xml
index 145c951..702652b 100644
--- a/modules/jaxws/pom.xml
+++ b/modules/jaxws/pom.xml
@@ -113,9 +113,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/jaxws</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/jaxws</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxws</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxws</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxws</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java b/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java
index d0ba927..3fce897 100644
--- a/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java
+++ b/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java
@@ -47,7 +47,9 @@ import org.apache.axis2.jaxws.message.util.MessageUtils;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
 import org.apache.axis2.jaxws.util.Constants;
 import org.apache.axis2.jaxws.utility.ClassUtils;
+import org.apache.axis2.transport.http.HTTPAuthenticator;
 import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.HTTPTransportConstants;
 import org.apache.axis2.transport.http.HttpTransportProperties;
 import org.apache.axis2.util.ThreadContextMigratorUtil;
 import org.apache.axis2.wsdl.WSDLConstants;
@@ -521,9 +523,22 @@ public class AxisInvocationController extends InvocationControllerImpl {
             catch (MalformedURLException e) {
                 throw ExceptionFactory.makeWebServiceException(e);
             }
+            
+            /*
+             * Check HTTPClient version to set HTTPAuthenticator. By default it
+             * use HTTPClient 3.x
+             */
+            HTTPAuthenticator basicAuthentication;
+            System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx");
+            String httpClientVersion = getHTTPClientVersion(mc.getAxisMessageContext());
+            if (httpClientVersion != null
+                    && HTTPTransportConstants.HTTP_CLIENT_4_X_VERSION.equals(httpClientVersion)) {
+                basicAuthentication = new org.apache.axis2.transport.http.impl.httpclient4.HttpTransportPropertiesImpl.Authenticator();
 
-            HttpTransportProperties.Authenticator basicAuthentication =
-                    new HttpTransportProperties.Authenticator();
+            } else {
+                basicAuthentication = new org.apache.axis2.transport.http.impl.httpclient3.HttpTransportPropertiesImpl.Authenticator();
+
+            }             
             basicAuthentication.setUsername(userId);
             basicAuthentication.setPassword(password);
             basicAuthentication.setHost(url.getHost());
@@ -693,5 +708,15 @@ public class AxisInvocationController extends InvocationControllerImpl {
         }
         return soapFaultDisabled;
     }
+    
+    private String getHTTPClientVersion(org.apache.axis2.context.MessageContext msgCtx) {
+        /*
+         * TODO - 
+         *  1.) Need to read HTTPClient version property value from ConfigurationContext.
+         *  2.) pre-condition, Have to set above value to ConfigurationContext
+         * 
+         */      
+        return null;
+    }
 
 }
diff --git a/modules/jibx/pom.xml b/modules/jibx/pom.xml
index 66e6c34..11ea548 100644
--- a/modules/jibx/pom.xml
+++ b/modules/jibx/pom.xml
@@ -69,9 +69,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/jibx</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/jibx</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/jibx</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/jibx</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/jibx</url>
     </scm>
     <build>
         <resources>
diff --git a/modules/json/pom.xml b/modules/json/pom.xml
index de60d59..c44dace 100644
--- a/modules/json/pom.xml
+++ b/modules/json/pom.xml
@@ -58,9 +58,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/json</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/json</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/json</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/json</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/json</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/kernel/pom.xml b/modules/kernel/pom.xml
index cd98c94..445d7ce 100644
--- a/modules/kernel/pom.xml
+++ b/modules/kernel/pom.xml
@@ -96,9 +96,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/kernel</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/kernel</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/kernel</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/kernel</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/kernel</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/metadata/pom.xml b/modules/metadata/pom.xml
index 9f65c9c..99fd4f3 100755
--- a/modules/metadata/pom.xml
+++ b/modules/metadata/pom.xml
@@ -121,9 +121,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/metadata</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/metadata</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/metadata</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/metadata</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/metadata</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/mex/pom.xml b/modules/mex/pom.xml
index fc2f8ef..6b22743 100644
--- a/modules/mex/pom.xml
+++ b/modules/mex/pom.xml
@@ -40,9 +40,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/mex</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/mex</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/mex</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/mex</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/mex</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/mex</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/mtompolicy-mar/pom.xml b/modules/mtompolicy-mar/pom.xml
index 8e0cca9..faff4e2 100644
--- a/modules/mtompolicy-mar/pom.xml
+++ b/modules/mtompolicy-mar/pom.xml
@@ -49,9 +49,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/mtompolicy-mar</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/mtompolicy-mar</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/mtompolicy-mar</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/mtompolicy-mar</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/mtompolicy-mar</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/mtompolicy-mar</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/mtompolicy/pom.xml b/modules/mtompolicy/pom.xml
index 6c8cf42..9efc933 100644
--- a/modules/mtompolicy/pom.xml
+++ b/modules/mtompolicy/pom.xml
@@ -43,9 +43,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/mtompolicy</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/mtompolicy</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/mtompolicy</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/mtompolicy</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/mtompolicy</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/mtompolicy</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/osgi/pom.xml b/modules/osgi/pom.xml
index b3affd9..418bd77 100644
--- a/modules/osgi/pom.xml
+++ b/modules/osgi/pom.xml
@@ -35,9 +35,9 @@
     <description>Apache Axis2 OSGi Integration</description>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/osgi</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/osgi</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/osgi</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/osgi</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/osgi</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
@@ -117,6 +117,7 @@
                             org.apache.axiom.*,
                             org.apache.commons.fileupload.*,
                             org.apache.commons.httpclient.*,
+                            org.apache.http.auth.*;resolution:=optional,
                             org.apache.commons.lang;resolution:=optional,
                             org.apache.commons.logging,
                             org.apache.http;resolution:=optional,
diff --git a/modules/parent/pom.xml b/modules/parent/pom.xml
index c523281..57ab0ac 100644
--- a/modules/parent/pom.xml
+++ b/modules/parent/pom.xml
@@ -998,9 +998,9 @@
         </profile>
     </profiles>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/parent</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/parent</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/parent</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/parent</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/parent</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/parent</url>
     </scm>
     <build>
         <pluginManagement>
diff --git a/modules/ping/pom.xml b/modules/ping/pom.xml
index f8a12fd..e9945d7 100644
--- a/modules/ping/pom.xml
+++ b/modules/ping/pom.xml
@@ -40,9 +40,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/ping</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/ping</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/ping</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/ping</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/ping</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/ping</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/resource-bundle/pom.xml b/modules/resource-bundle/pom.xml
index f97a91f..d27372a 100644
--- a/modules/resource-bundle/pom.xml
+++ b/modules/resource-bundle/pom.xml
@@ -32,9 +32,9 @@
     <description>Contains the legal files that must be included in all artifacts</description>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/resource-bundle</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/resource-bundle</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/resource-bundle</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/resource-bundle</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/resource-bundle</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/resource-bundle</url>
     </scm>
     <build>
         <plugins>
diff --git a/modules/saaj/pom.xml b/modules/saaj/pom.xml
index b7188cf..86945a3 100644
--- a/modules/saaj/pom.xml
+++ b/modules/saaj/pom.xml
@@ -32,9 +32,9 @@
     <description>Axis2 SAAJ implementation</description>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/saaj</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/saaj</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/saaj</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/saaj</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/saaj</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/saaj</url>
     </scm>
     <dependencies>
         <dependency>
diff --git a/modules/samples/version/pom.xml b/modules/samples/version/pom.xml
index daa3e6b..1c08a33 100644
--- a/modules/samples/version/pom.xml
+++ b/modules/samples/version/pom.xml
@@ -30,9 +30,9 @@
     <name>Apache Axis2 - Version Service</name>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/samples/version</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/samples/version</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/samples/version</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/samples/version</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/samples/version</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/samples/version</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/scripting/pom.xml b/modules/scripting/pom.xml
index 385350b..d155702 100644
--- a/modules/scripting/pom.xml
+++ b/modules/scripting/pom.xml
@@ -52,9 +52,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/scripting</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/scripting</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/scripting</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/scripting</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/scripting</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/scripting</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/soapmonitor/module/pom.xml b/modules/soapmonitor/module/pom.xml
index 75a97e4..dcf8ddd 100644
--- a/modules/soapmonitor/module/pom.xml
+++ b/modules/soapmonitor/module/pom.xml
@@ -45,9 +45,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/soapmonitor/module</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/soapmonitor/module</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/soapmonitor/module</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/soapmonitor/module</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/soapmonitor/module</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/soapmonitor/module</url>
     </scm>
     <build>
         <plugins>
diff --git a/modules/soapmonitor/servlet/pom.xml b/modules/soapmonitor/servlet/pom.xml
index 332cec3..148a170 100644
--- a/modules/soapmonitor/servlet/pom.xml
+++ b/modules/soapmonitor/servlet/pom.xml
@@ -43,9 +43,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/soapmonitor/servlet</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/soapmonitor/servlet</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/soapmonitor/servlet</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/soapmonitor/servlet</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/soapmonitor/servlet</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/soapmonitor/servlet</url>
     </scm>
     <build>
         <plugins>
diff --git a/modules/spring/pom.xml b/modules/spring/pom.xml
index c0d7802..a06fda2 100644
--- a/modules/spring/pom.xml
+++ b/modules/spring/pom.xml
@@ -55,9 +55,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/spring</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/spring</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/spring</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/spring</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/spring</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/spring</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/testutils/pom.xml b/modules/testutils/pom.xml
index f69a14b..352646e 100644
--- a/modules/testutils/pom.xml
+++ b/modules/testutils/pom.xml
@@ -37,9 +37,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/testutils</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/testutils</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/testutils</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/testutils</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/testutils</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/testutils</url>
     </scm>
     <build>
         <plugins>
diff --git a/modules/tool/archetype/quickstart-webapp/pom.xml b/modules/tool/archetype/quickstart-webapp/pom.xml
index 056acfd..38e8abb 100644
--- a/modules/tool/archetype/quickstart-webapp/pom.xml
+++ b/modules/tool/archetype/quickstart-webapp/pom.xml
@@ -19,8 +19,7 @@
   ~ under the License.
   -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 	<modelVersion>4.0.0</modelVersion>
 	<parent>
 		<groupId>org.apache.axis2</groupId>
diff --git a/modules/tool/archetype/quickstart/pom.xml b/modules/tool/archetype/quickstart/pom.xml
index f1776e9..8dc9a56 100644
--- a/modules/tool/archetype/quickstart/pom.xml
+++ b/modules/tool/archetype/quickstart/pom.xml
@@ -19,8 +19,7 @@
   ~ under the License.
   -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 	<modelVersion>4.0.0</modelVersion>
 	<parent>
 		<groupId>org.apache.axis2</groupId>
diff --git a/modules/tool/axis2-aar-maven-plugin/pom.xml b/modules/tool/axis2-aar-maven-plugin/pom.xml
index a1c7e72..5093c08 100644
--- a/modules/tool/axis2-aar-maven-plugin/pom.xml
+++ b/modules/tool/axis2-aar-maven-plugin/pom.xml
@@ -67,9 +67,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-aar-maven-plugin</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-aar-maven-plugin</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-aar-maven-plugin</url>
     </scm>
     <build>
         <plugins>
diff --git a/modules/tool/axis2-ant-plugin/pom.xml b/modules/tool/axis2-ant-plugin/pom.xml
index 83a226a..24c7cb9 100644
--- a/modules/tool/axis2-ant-plugin/pom.xml
+++ b/modules/tool/axis2-ant-plugin/pom.xml
@@ -32,9 +32,9 @@
     <description>The Axis 2 Plugin for Ant Tasks.</description>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-ant-plugin</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-ant-plugin</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-ant-plugin</url>
     </scm>
     <dependencies>
         <dependency>
diff --git a/modules/tool/axis2-eclipse-codegen-plugin/pom.xml b/modules/tool/axis2-eclipse-codegen-plugin/pom.xml
index 0137a8e..8f6ad0b 100644
--- a/modules/tool/axis2-eclipse-codegen-plugin/pom.xml
+++ b/modules/tool/axis2-eclipse-codegen-plugin/pom.xml
@@ -33,9 +33,9 @@
     <description>The Axis 2 Eclipse Codegen Plugin for wsdl2java and java2wsdl</description>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-codegen-plugin</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-codegen-plugin</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-codegen-plugin</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-eclipse-codegen-plugin</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-eclipse-codegen-plugin</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-eclipse-codegen-plugin</url>
     </scm>
     <dependencies>
         <dependency>
diff --git a/modules/tool/axis2-eclipse-service-plugin/pom.xml b/modules/tool/axis2-eclipse-service-plugin/pom.xml
index ea83934..f38f493 100644
--- a/modules/tool/axis2-eclipse-service-plugin/pom.xml
+++ b/modules/tool/axis2-eclipse-service-plugin/pom.xml
@@ -33,9 +33,9 @@
     <description>The Axis 2 Eclipse Service Plugin for Service archive creation</description>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-service-plugin</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-service-plugin</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-service-plugin</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-eclipse-service-plugin</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-eclipse-service-plugin</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-eclipse-service-plugin</url>
     </scm>
     <dependencies>
         <dependency>
diff --git a/modules/tool/axis2-idea-plugin/pom.xml b/modules/tool/axis2-idea-plugin/pom.xml
index 57e80ff..1ae7f6f 100644
--- a/modules/tool/axis2-idea-plugin/pom.xml
+++ b/modules/tool/axis2-idea-plugin/pom.xml
@@ -34,9 +34,9 @@
     </description>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-idea-plugin</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-idea-plugin</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-idea-plugin</url>
     </scm>
     <dependencies>
         <dependency>
diff --git a/modules/tool/axis2-java2wsdl-maven-plugin/pom.xml b/modules/tool/axis2-java2wsdl-maven-plugin/pom.xml
index 1477a63..e535c13 100644
--- a/modules/tool/axis2-java2wsdl-maven-plugin/pom.xml
+++ b/modules/tool/axis2-java2wsdl-maven-plugin/pom.xml
@@ -35,9 +35,9 @@
     <packaging>maven-plugin</packaging>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-java2wsdl-maven-plugin</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-java2wsdl-maven-plugin</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-java2wsdl-maven-plugin</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-java2wsdl-maven-plugin</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-java2wsdl-maven-plugin</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-java2wsdl-maven-plugin</url>
     </scm>
     <build>
         <sourceDirectory>src/main/java</sourceDirectory>
diff --git a/modules/tool/axis2-mar-maven-plugin/pom.xml b/modules/tool/axis2-mar-maven-plugin/pom.xml
index 0629980..706ec7b 100644
--- a/modules/tool/axis2-mar-maven-plugin/pom.xml
+++ b/modules/tool/axis2-mar-maven-plugin/pom.xml
@@ -68,9 +68,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-mar-maven-plugin</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-mar-maven-plugin</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-mar-maven-plugin</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-mar-maven-plugin</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-mar-maven-plugin</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-mar-maven-plugin</url>
     </scm>
     <build>
         <plugins>
diff --git a/modules/tool/axis2-repo-maven-plugin/pom.xml b/modules/tool/axis2-repo-maven-plugin/pom.xml
index cad455a..db7b83b 100644
--- a/modules/tool/axis2-repo-maven-plugin/pom.xml
+++ b/modules/tool/axis2-repo-maven-plugin/pom.xml
@@ -48,9 +48,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-repo-maven-plugin</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-repo-maven-plugin</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-repo-maven-plugin</url>
     </scm>
     <build>
         <plugins>
diff --git a/modules/tool/axis2-wsdl2code-maven-plugin/pom.xml b/modules/tool/axis2-wsdl2code-maven-plugin/pom.xml
index df0b76e..091ab99 100644
--- a/modules/tool/axis2-wsdl2code-maven-plugin/pom.xml
+++ b/modules/tool/axis2-wsdl2code-maven-plugin/pom.xml
@@ -33,9 +33,9 @@
     <description>The Axis 2 Plugin for Maven allows client side and server side sources from a WSDL.</description>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-wsdl2code-maven-plugin</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-wsdl2code-maven-plugin</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/axis2-wsdl2code-maven-plugin</url>
     </scm>
     <dependencies>
         <dependency>
diff --git a/modules/tool/simple-server-maven-plugin/pom.xml b/modules/tool/simple-server-maven-plugin/pom.xml
index 302a9c0..6f8a9fe 100644
--- a/modules/tool/simple-server-maven-plugin/pom.xml
+++ b/modules/tool/simple-server-maven-plugin/pom.xml
@@ -19,8 +19,7 @@
   ~ under the License.
   -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.axis2</groupId>
@@ -34,9 +33,9 @@
     <description>The Axis2 Plugin for Maven that allows to run simple HTTP server.</description>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/simple-server-maven-plugin</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/simple-server-maven-plugin</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/simple-server-maven-plugin</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/simple-server-maven-plugin</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/simple-server-maven-plugin</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/tool/simple-server-maven-plugin</url>
     </scm>
     <build>
         <plugins>
diff --git a/modules/transport/http/pom.xml b/modules/transport/http/pom.xml
index 6d1cfde..b090c2e 100644
--- a/modules/transport/http/pom.xml
+++ b/modules/transport/http/pom.xml
@@ -33,9 +33,9 @@
     <packaging>bundle</packaging>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/transport/http</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/transport/http</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
@@ -109,5 +109,16 @@
             <groupId>commons-httpclient</groupId>
             <artifactId>commons-httpclient</artifactId>
         </dependency>
+	<dependency>
+		<groupId>org.apache.httpcomponents</groupId>
+		<artifactId>httpclient</artifactId>
+		<version>4.1.2</version>
+<!-- 		<exclusions> -->
+<!-- 			<exclusion> -->
+<!-- 				<groupId>org.apache.httpcomponents</groupId> -->
+<!-- 				<artifactId>httpcore</artifactId> -->
+<!-- 			</exclusion> -->
+<!-- 		</exclusions> -->
+	</dependency>
     </dependencies>
 </project>
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java b/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
index f02875a..09bd9c2 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
@@ -19,65 +19,27 @@
 
 package org.apache.axis2.transport.http;
 
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
+
+import java.io.IOException;
+import java.net.URL;
+
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.NamedValue;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.transport.MessageFormatter;
-import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.transport.http.util.HTTPProxyConfigurationUtil;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.commons.httpclient.Credentials;
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HeaderElement;
-import org.apache.commons.httpclient.HostConfiguration;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpConnectionManager;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.apache.commons.httpclient.HttpState;
-import org.apache.commons.httpclient.HttpVersion;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.NTCredentials;
-import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.auth.AuthPolicy;
-import org.apache.commons.httpclient.auth.AuthScope;
-import org.apache.commons.httpclient.params.HttpMethodParams;
-import org.apache.commons.httpclient.protocol.Protocol;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.http.protocol.HTTP;
 
-import javax.xml.namespace.QName;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.zip.GZIPInputStream;
+
+
 
 public abstract class AbstractHTTPSender {
-    protected static final String ANONYMOUS = "anonymous";
-    protected static final String PROXY_HOST_NAME = "proxy_host";
-    protected static final String PROXY_PORT = "proxy_port";
+    
     protected boolean chunked = false;
     protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
-    private static final Log log = LogFactory.getLog(AbstractHTTPSender.class);
-
-    protected static final String PROTOCOL_HTTP = "http";
-    protected static final String PROTOCOL_HTTPS = "https";
+    
+    private static final Log log = LogFactory.getLog(AbstractHTTPSender.class);   
 
     /**
      * proxydiscription
@@ -109,638 +71,13 @@ public abstract class AbstractHTTPSender {
                                 + " Can have values only HTTP/1.0 or HTTP/1.1");
             }
         }
-    }
-
-    /**
-     * Collect the HTTP header information and set them in the message context
-     *
-     * @param method HttpMethodBase from which to get information
-     * @param msgContext the MessageContext in which to place the information... OR NOT!
-     * @throws AxisFault if problems occur
-     */
-    protected void obtainHTTPHeaderInformation(HttpMethodBase method,
-                                               MessageContext msgContext) throws AxisFault {
-        // Set RESPONSE properties onto the REQUEST message context.  They will need to be copied off the request context onto
-        // the response context elsewhere, for example in the OutInOperationClient.
-        Map transportHeaders = new CommonsTransportHeaders(method.getResponseHeaders());
-        msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, transportHeaders);
-        msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE, new Integer(method.getStatusCode()));
-        Header header = method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
-
-        if (header != null) {
-            HeaderElement[] headers = header.getElements();
-            MessageContext inMessageContext = msgContext.getOperationContext().getMessageContext(
-                    WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-
-            Object contentType = header.getValue();
-            Object charSetEnc = null;
-
-            for (int i = 0; i < headers.length; i++) {
-                NameValuePair charsetEnc = headers[i].getParameterByName(
-                        HTTPConstants.CHAR_SET_ENCODING);
-                if (charsetEnc != null) {
-                    charSetEnc = charsetEnc.getValue();
-                }
-            }
-
-            if (inMessageContext != null) {
-                inMessageContext
-                        .setProperty(Constants.Configuration.CONTENT_TYPE, contentType);
-                inMessageContext
-                        .setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
-            } else {
-
-                // Transport details will be stored in a HashMap so that anybody interested can
-                // retrieve them
-                HashMap transportInfoMap = new HashMap();
-                transportInfoMap.put(Constants.Configuration.CONTENT_TYPE, contentType);
-                transportInfoMap.put(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
-
-                //the HashMap is stored in the outgoing message.
-                msgContext.setProperty(Constants.Configuration.TRANSPORT_INFO_MAP,
-                                       transportInfoMap);
-            }
-        }
-
-        String sessionCookie = null;
-        // Process old style headers first
-        Header[] cookieHeaders = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE);
-        String customCoookiId = (String) msgContext.getProperty(Constants.CUSTOM_COOKIE_ID);
-        for (int i = 0; i < cookieHeaders.length; i++) {
-            HeaderElement[] elements = cookieHeaders[i].getElements();
-            for (int e = 0; e < elements.length; e++) {
-                HeaderElement element = elements[e];
-                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) ||
-                        Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
-                    sessionCookie = processCookieHeader(element);
-                }
-                if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) {
-                    sessionCookie = processCookieHeader(element);
-                }
-            }
-        }
-        // Overwrite old style cookies with new style ones if present
-        cookieHeaders = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE2);
-        for (int i = 0; i < cookieHeaders.length; i++) {
-            HeaderElement[] elements = cookieHeaders[i].getElements();
-            for (int e = 0; e < elements.length; e++) {
-                HeaderElement element = elements[e];
-                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) ||
-                        Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
-                    sessionCookie = processCookieHeader(element);
-                }
-                if(customCoookiId!=null&&customCoookiId.equalsIgnoreCase(element.getName())){
-                    sessionCookie = processCookieHeader(element);
-                }
-            }
-        }
-
-        if (sessionCookie != null) {
-            msgContext.getServiceContext().setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
-        }
-    }
-
-    private String processCookieHeader(HeaderElement element) {
-        String cookie = element.getName() + "=" + element.getValue();
-        NameValuePair[] parameters =  element.getParameters();
-        for (int j = 0; parameters != null && j < parameters.length; j++) {
-            NameValuePair parameter = parameters[j];
-            cookie = cookie + "; " + parameter.getName() + "=" + parameter.getValue();
-        }
-        return cookie;
-    }
-
-    protected void processResponse(HttpMethodBase httpMethod,
-                                   MessageContext msgContext)
-            throws IOException {
-        obtainHTTPHeaderInformation(httpMethod, msgContext);
-
-        InputStream in = httpMethod.getResponseBodyAsStream();
-        if (in == null) {
-            throw new AxisFault(Messages.getMessage("canNotBeNull", "InputStream"));
-        }
-        Header contentEncoding =
-                httpMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_ENCODING);
-        if (contentEncoding != null) {
-            if (contentEncoding.getValue().
-                    equalsIgnoreCase(HTTPConstants.COMPRESSION_GZIP)) {
-                in = new GZIPInputStream(in);
-                // If the content-encoding is identity we can basically ignore it.
-            } else if (!"identity".equalsIgnoreCase(contentEncoding.getValue())) {
-                throw new AxisFault("HTTP :" + "unsupported content-encoding of '"
-                        + contentEncoding.getValue() + "' found");
-            }
-        }
-
-        OperationContext opContext = msgContext.getOperationContext();
-        if (opContext != null) {
-            opContext.setProperty(MessageContext.TRANSPORT_IN, in);
-        }
-    }
+    }       
 
     public abstract void send(MessageContext msgContext, URL url, String soapActionString)
-            throws IOException;
-
-    /**
-     * getting host configuration to support standard http/s, proxy and NTLM support
-     *
-     * @param client active HttpClient
-     * @param msgCtx active MessageContext
-     * @param targetURL the target URL
-     * @return a HostConfiguration set up with proxy information
-     * @throws AxisFault if problems occur
-     */
-    protected HostConfiguration getHostConfiguration(HttpClient client,
-                                                     MessageContext msgCtx,
-                                                     URL targetURL)throws AxisFault {
-
-        boolean isAuthenticationEnabled = isAuthenticationEnabled(msgCtx);
-        int port = targetURL.getPort();
-
-        String protocol = targetURL.getProtocol();
-        if (port == -1) {
-            if (PROTOCOL_HTTP.equals(protocol)) {
-                port = 80;
-            } else if (PROTOCOL_HTTPS.equals(protocol)) {
-                port = 443;
-            }
-
-        }
-
-        // to see the host is a proxy and in the proxy list - available in axis2.xml
-        HostConfiguration config = new HostConfiguration();
-
-        // one might need to set his own socket factory. Let's allow that case as well.
-        Protocol protocolHandler =
-                (Protocol)msgCtx.getOptions().getProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER);
-
-        // setting the real host configuration
-        // I assume the 90% case, or even 99% case will be no protocol handler case.
-        if (protocolHandler == null) {
-            config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
-        } else {
-            config.setHost(targetURL.getHost(), port, protocolHandler);
-        }
-
-        if (isAuthenticationEnabled) {
-            // Basic, Digest, NTLM and custom authentications.
-            this.setAuthenticationInfo(client, msgCtx, config);
-        }
-        // proxy configuration
-
-        if (HTTPProxyConfigurationUtil.isProxyEnabled(msgCtx, targetURL)) {
-            if(log.isDebugEnabled()){
-                log.debug("Configuring HTTP proxy.");
-            }
-            HTTPProxyConfigurationUtil.configure(msgCtx, client, config);
-        }
-
-        return config;
-    }
-
-    protected boolean isAuthenticationEnabled(MessageContext msgCtx) {
-        return (msgCtx.getProperty(HTTPConstants.AUTHENTICATE) != null);
-    }
-
-    /*
-    This will handle server Authentication, It could be either NTLM, Digest or Basic Authentication.
-    Apart from that user can change the priory or add a custom authentication scheme.
-    */
-    protected void setAuthenticationInfo(HttpClient agent,
-                                         MessageContext msgCtx,
-                                         HostConfiguration config) throws AxisFault {
-        HttpTransportProperties.Authenticator authenticator;
-        Object obj = msgCtx.getProperty(HTTPConstants.AUTHENTICATE);
-        if (obj != null) {
-            if (obj instanceof HttpTransportProperties.Authenticator) {
-                authenticator = (HttpTransportProperties.Authenticator) obj;
-
-                String username = authenticator.getUsername();
-                String password = authenticator.getPassword();
-                String host = authenticator.getHost();
-                String domain = authenticator.getDomain();
-
-                int port = authenticator.getPort();
-                String realm = authenticator.getRealm();
-
-                /* If retrying is available set it first */
-                isAllowedRetry = authenticator.isAllowedRetry();
-
-                Credentials creds;
-
-                HttpState tmpHttpState = null;
-                HttpState httpState = (HttpState)msgCtx.getProperty(HTTPConstants.CACHED_HTTP_STATE);
-                if (httpState != null) {
-                    tmpHttpState = httpState;
-                } else {
-                    tmpHttpState = agent.getState();
-                }
-                
-                agent.getParams()
-                        .setAuthenticationPreemptive(authenticator.getPreemptiveAuthentication());
-
-                if (host != null) {
-                    if (domain != null) {
-                        /*Credentials for NTLM Authentication*/
-                        creds = new NTCredentials(username, password, host, domain);
-                    } else {
-                        /*Credentials for Digest and Basic Authentication*/
-                        creds = new UsernamePasswordCredentials(username, password);
-                    }
-                    tmpHttpState.setCredentials(new AuthScope(host, port, realm), creds);
-                } else {
-                    if (domain != null) {
-                        /*Credentials for NTLM Authentication when host is ANY_HOST*/
-                        creds = new NTCredentials(username, password, AuthScope.ANY_HOST, domain);
-                        tmpHttpState.setCredentials(
-                                new AuthScope(AuthScope.ANY_HOST, port, realm), creds);
-                    } else {
-                        /*Credentials only for Digest and Basic Authentication*/
-                        creds = new UsernamePasswordCredentials(username, password);
-                        tmpHttpState.setCredentials(new AuthScope(AuthScope.ANY), creds);
-                    }
-                }
-                /* Customizing the priority Order */
-                List schemes = authenticator.getAuthSchemes();
-                if (schemes != null && schemes.size() > 0) {
-                    List authPrefs = new ArrayList(3);
-                    for (int i = 0; i < schemes.size(); i++) {
-                        if (schemes.get(i) instanceof AuthPolicy) {
-                            authPrefs.add(schemes.get(i));
-                            continue;
-                        }
-                        String scheme = (String) schemes.get(i);
-                        if (HttpTransportProperties.Authenticator.BASIC.equals(scheme)) {
-                            authPrefs.add(AuthPolicy.BASIC);
-                        } else if (HttpTransportProperties.Authenticator.NTLM.equals(scheme)) {
-                            authPrefs.add(AuthPolicy.NTLM);
-                        } else if (HttpTransportProperties.Authenticator.DIGEST.equals(scheme)) {
-                            authPrefs.add(AuthPolicy.DIGEST);
-                        }
-                    }
-                    agent.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY,
-                            authPrefs);
-                }
-
-            } else {
-                throw new AxisFault("HttpTransportProperties.Authenticator class cast exception");
-            }
-        }
-
-    }
-
-    /**
-     * Method used to copy all the common properties
-     *
-     * @param msgContext       - The messageContext of the request message
-     * @param url              - The target URL
-     * @param httpMethod       - The http method used to send the request
-     * @param httpClient       - The httpclient used to send the request
-     * @param soapActionString - The soap action atring of the request message
-     * @return MessageFormatter - The messageFormatter for the relavent request message
-     * @throws AxisFault - Thrown in case an exception occurs
-     */
-    protected MessageFormatter populateCommonProperties(MessageContext msgContext, URL url,
-                                                      HttpMethodBase httpMethod,
-                                                      HttpClient httpClient,
-                                                      String soapActionString)
-            throws AxisFault {
-
-        if (isAuthenticationEnabled(msgContext)) {
-            httpMethod.setDoAuthentication(true);
-        }
-
-        MessageFormatter messageFormatter = TransportUtils.getMessageFormatter(
-                msgContext);
-
-        url = messageFormatter.getTargetAddress(msgContext, format, url);
-
-        httpMethod.setPath(url.getPath());
-
-        httpMethod.setQueryString(url.getQuery());
-
-        httpMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
-                                    messageFormatter.getContentType(msgContext, format,
-                                                                    soapActionString));
-
-        httpMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url.getHost());
-
-        if (msgContext.getOptions() != null && msgContext.getOptions().isManageSession()) {
-            // setting the cookie in the out path
-            Object cookieString = msgContext.getProperty(HTTPConstants.COOKIE_STRING);
-
-            if (cookieString != null) {
-                StringBuffer buffer = new StringBuffer();
-                buffer.append(cookieString);
-                httpMethod.setRequestHeader(HTTPConstants.HEADER_COOKIE, buffer.toString());
-            }
-        }
-
-        if (httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)) {
-            httpClient.getParams().setVersion(HttpVersion.HTTP_1_0);
-        }
-        return messageFormatter;
-    }
-
-    /**
-     * This is used to get the dynamically set time out values from the
-     * message context. If the values are not available or invalid then
-     * the default values or the values set by the configuration will be used
-     *
-     * @param msgContext the active MessageContext
-     * @param httpClient
-     */
-    protected void initializeTimeouts(MessageContext msgContext, HttpClient httpClient) {
-        // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
-        // override the static config
-        Integer tempSoTimeoutProperty =
-                (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT);
-        Integer tempConnTimeoutProperty =
-                (Integer) msgContext
-                        .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
-        long timeout = msgContext.getOptions().getTimeOutInMilliSeconds();
-
-        if (tempConnTimeoutProperty != null) {
-            int connectionTimeout = tempConnTimeoutProperty.intValue();
-            // timeout for initial connection
-            httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(connectionTimeout);
-        } else {
-            // set timeout in client
-            if (timeout > 0) {
-                httpClient.getHttpConnectionManager().getParams().setConnectionTimeout((int) timeout);
-            }
-        }
-
-        if (tempSoTimeoutProperty != null) {
-            int soTimeout = tempSoTimeoutProperty.intValue();
-            // SO_TIMEOUT -- timeout for blocking reads
-            httpClient.getHttpConnectionManager().getParams().setSoTimeout(soTimeout);
-            httpClient.getParams().setSoTimeout(soTimeout);
-        } else {
-            // set timeout in client
-            if (timeout > 0) {
-                httpClient.getHttpConnectionManager().getParams().setSoTimeout((int) timeout);
-                httpClient.getParams().setSoTimeout((int) timeout);
-            }
-        }
-    }
-
-    /**
-     * This is used to get the dynamically set time out values from the
-     * message context. If the values are not available or invalid then
-     * the default values or the values set by the configuration will be used
-     *
-     * @param msgContext the active MessageContext
-     * @param httpMethod method
-     */
-    protected void setTimeouts(MessageContext msgContext, HttpMethod httpMethod) {
-        // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
-        // override the static config
-        Integer tempSoTimeoutProperty =
-                (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT);
-        Integer tempConnTimeoutProperty =
-                (Integer) msgContext
-                        .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
-        long timeout = msgContext.getOptions().getTimeOutInMilliSeconds();
-
-        if (tempConnTimeoutProperty != null) {
-            // timeout for initial connection
-            httpMethod.getParams().setParameter("http.connection.timeout",
-                    tempConnTimeoutProperty);
-        }
-
-        if (tempSoTimeoutProperty != null) {
-            // SO_TIMEOUT -- timeout for blocking reads
-            httpMethod.getParams().setSoTimeout(tempSoTimeoutProperty);
-        } else {
-            // set timeout in client
-            if (timeout > 0) {
-                httpMethod.getParams().setSoTimeout((int) timeout);
-            }
-        }
-    }
+            throws IOException;   
 
     public void setFormat(OMOutputFormat format) {
         this.format = format;
-    }
-
-    protected HttpClient getHttpClient(MessageContext msgContext) {
-        ConfigurationContext configContext = msgContext.getConfigurationContext();
-
-        HttpClient httpClient = (HttpClient) msgContext.getProperty(
-                HTTPConstants.CACHED_HTTP_CLIENT);
-
-        if (httpClient == null) {
-            httpClient = (HttpClient) configContext.getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
-        }
-
-        if (httpClient != null) {
-            return httpClient;
-        }
-
-        synchronized (this) {
-            httpClient = (HttpClient) msgContext.getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
-
-            if (httpClient == null) {
-                httpClient = (HttpClient) configContext.getProperty(
-                        HTTPConstants.CACHED_HTTP_CLIENT);
-            }
-
-            if (httpClient != null) {
-                return httpClient;
-            }
-
-            HttpConnectionManager connManager =
-                    (HttpConnectionManager) msgContext.getProperty(
-                            HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
-            if (connManager == null) {
-                connManager =
-                        (HttpConnectionManager) msgContext.getProperty(
-                                HTTPConstants.MUTTITHREAD_HTTP_CONNECTION_MANAGER);
-            }
-            if (connManager == null) {
-                // reuse HttpConnectionManager
-                synchronized (configContext) {
-                    connManager = (HttpConnectionManager) configContext.getProperty(
-                            HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
-                    if (connManager == null) {
-                        log.trace("Making new ConnectionManager");
-                        connManager = new MultiThreadedHttpConnectionManager();
-                        configContext.setProperty(
-                                HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER, connManager);
-                    }
-                }
-            }
-            /*
-             * Create a new instance of HttpClient since the way
-             * it is used here it's not fully thread-safe.
-             */
-            httpClient = new HttpClient(connManager);
-
-            // Set the default timeout in case we have a connection pool starvation to 30sec
-            httpClient.getParams().setConnectionManagerTimeout(30000);
-
-            // Get the timeout values set in the runtime
-            initializeTimeouts(msgContext, httpClient);
-
-            return httpClient;
-        }
-    }
-
-    protected void executeMethod(HttpClient httpClient, MessageContext msgContext, URL url,
-                                 HttpMethod method) throws IOException {
-        HostConfiguration config = this.getHostConfiguration(httpClient, msgContext, url);
-
-        // set the custom headers, if available
-        addCustomHeaders(method, msgContext);
-
-        // add compression headers if needed
-        if (msgContext.isPropertyTrue(HTTPConstants.MC_ACCEPT_GZIP)) {
-            method.addRequestHeader(HTTPConstants.HEADER_ACCEPT_ENCODING,
-                    HTTPConstants.COMPRESSION_GZIP);
-        }
-
-        if (msgContext.isPropertyTrue(HTTPConstants.MC_GZIP_REQUEST)) {
-            method.addRequestHeader(HTTPConstants.HEADER_CONTENT_ENCODING,
-                    HTTPConstants.COMPRESSION_GZIP);
-        }
-        
-        if (msgContext.getProperty(HTTPConstants.HTTP_METHOD_PARAMS) != null) {
-            HttpMethodParams params = (HttpMethodParams)msgContext
-                    .getProperty(HTTPConstants.HTTP_METHOD_PARAMS);
-            method.setParams(params);
-        }
-
-        String cookiePolicy = (String) msgContext.getProperty(HTTPConstants.COOKIE_POLICY);
-        if (cookiePolicy != null) {
-            method.getParams().setCookiePolicy(cookiePolicy);   
-        }
-        HttpState httpState = (HttpState)msgContext.getProperty(HTTPConstants.CACHED_HTTP_STATE);
-
-        setTimeouts(msgContext, method);
-
-        httpClient.executeMethod(config, method, httpState);
-    }
-
-    public void addCustomHeaders(HttpMethod method, MessageContext msgContext) {
-
-        boolean isCustomUserAgentSet = false;
-        // set the custom headers, if available
-        Object httpHeadersObj = msgContext.getProperty(HTTPConstants.HTTP_HEADERS);
-        if (httpHeadersObj != null) {
-            if (httpHeadersObj instanceof List) {
-                List httpHeaders = (List) httpHeadersObj;
-                for (int i = 0; i < httpHeaders.size(); i++) {
-                    NamedValue nv = (NamedValue) httpHeaders.get(i);
-                    if (nv != null) {
-                        Header header = new Header(nv.getName(), nv.getValue());
-                        if (HTTPConstants.HEADER_USER_AGENT.equals(header.getName())) {
-                            isCustomUserAgentSet = true;
-                        }
-                        method.addRequestHeader(header);
-                    }
-                }
-    
-            }
-            if (httpHeadersObj instanceof Map) {
-                Map httpHeaders = (Map) httpHeadersObj;
-                for (Iterator iterator = httpHeaders.entrySet().iterator(); iterator.hasNext();) {
-                    Map.Entry entry  = (Map.Entry) iterator.next();
-                    String key = (String) entry.getKey();
-                    String value = (String) entry.getValue();
-                    if (HTTPConstants.HEADER_USER_AGENT.equals(key)) {
-                        isCustomUserAgentSet = true;
-                    }
-                    method.addRequestHeader(key, value);
-                }
-            }
-        }
-
-        // we have to consider the TRANSPORT_HEADERS map as well
-        Map transportHeaders = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
-        if (transportHeaders != null) {
-            removeUnwantedHeaders(msgContext);
-
-            Set headerEntries = transportHeaders.entrySet();
-
-            for (Object headerEntry : headerEntries) {
-                if (headerEntry instanceof Map.Entry) {
-                    Header[] headers = method.getRequestHeaders();
-
-                    boolean headerAdded = false;
-                    for (Header header : headers) {
-                        if (header.getName() != null &&                                 
-                                header.getName().equals(((Map.Entry) headerEntry).getKey())) {
-                            headerAdded = true;
-                            break;
-                        }
-                    }
-
-                    if (!headerAdded) {
-                        method.addRequestHeader(((Map.Entry) headerEntry).getKey().toString(),
-                                ((Map.Entry) headerEntry).getValue().toString());
-                    }
-                }
-            }
-        }
-
-        if (!isCustomUserAgentSet) {
-            String userAgentString = getUserAgent(msgContext);
-            method.setRequestHeader(HTTPConstants.HEADER_USER_AGENT, userAgentString);
-        }
-
-    }
-
-
-    /**
-     * Remove unwanted headers from the transport headers map of outgoing request. These are headers which
-     * should be dictated by the transport and not the user. We remove these as these may get
-     * copied from the request messages
-     *
-     * @param msgContext the Axis2 Message context from which these headers should be removed
-     */
-    private void removeUnwantedHeaders(MessageContext msgContext) {
-        Map headers = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
-
-        if (headers == null || headers.isEmpty()) {
-            return;
-        }
-
-        Iterator iter = headers.keySet().iterator();
-        while (iter.hasNext()) {
-            String headerName = (String) iter.next();
-            if (HTTP.CONN_DIRECTIVE.equalsIgnoreCase(headerName) ||
-                HTTP.TRANSFER_ENCODING.equalsIgnoreCase(headerName) ||
-                HTTP.DATE_HEADER.equalsIgnoreCase(headerName) ||
-                HTTP.CONTENT_TYPE.equalsIgnoreCase(headerName) ||
-                HTTP.CONTENT_LEN.equalsIgnoreCase(headerName)) {
-                iter.remove();
-            }
-        }
-    }
-
-    private String getUserAgent(MessageContext messageContext) {
-        String userAgentString = "Axis2";
-        boolean locked = false;
-        if (messageContext.getParameter(HTTPConstants.USER_AGENT) != null) {
-            OMElement userAgentElement =
-                    messageContext.getParameter(HTTPConstants.USER_AGENT).getParameterElement();
-            userAgentString = userAgentElement.getText().trim();
-            OMAttribute lockedAttribute = userAgentElement.getAttribute(new QName("locked"));
-            if (lockedAttribute != null) {
-                if (lockedAttribute.getAttributeValue().equalsIgnoreCase("true")) {
-                    locked = true;
-                }
-            }
-        }
-        // Runtime overing part
-        if (!locked) {
-            if (messageContext.getProperty(HTTPConstants.USER_AGENT) != null) {
-                userAgentString = (String) messageContext.getProperty(HTTPConstants.USER_AGENT);
-            }
-        }
-
-        return userAgentString;
-    }
+    }  
     
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java b/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java
index 0de3084..8834def 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java
@@ -24,7 +24,6 @@ import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.transport.MessageFormatter;
 import org.apache.axis2.util.JavaUtils;
-import org.apache.commons.httpclient.methods.RequestEntity;
 
 import javax.xml.stream.FactoryConfigurationError;
 import java.io.IOException;
@@ -35,7 +34,7 @@ import java.util.zip.GZIPOutputStream;
  * This Request Entity is used by the HTTPCommonsTransportSender. This wraps the
  * Axis2 message formatter object.
  */
-public class AxisRequestEntity implements RequestEntity {
+public abstract class AxisRequestEntity  {
 
     private MessageFormatter messageFormatter;
 
@@ -114,7 +113,17 @@ public class AxisRequestEntity implements RequestEntity {
         return bytes.length;
     }
 
-    public String getContentType() {
+    public String getContentTypeAsString() {
         return messageFormatter.getContentType(messageContext, format, soapAction);
     }
+
+    public boolean isChunked() {
+        return chunked;
+    }
+
+    public void setChunked(boolean chunked) {
+        this.chunked = chunked;
+    }
+    
+    
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java b/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
index ae43283..a9cb9ba 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
@@ -54,6 +54,7 @@ import org.apache.axis2.util.MessageContextBuilder;
 import org.apache.axis2.util.OnDemandLogger;
 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
 
+
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
@@ -555,7 +556,23 @@ public class AxisServlet extends HttpServlet {
         // AXIS2-4898: MultiThreadedHttpConnectionManager starts a thread that is not stopped by the
         // shutdown of the connection manager. If we want to avoid a resource leak, we need to call
         // shutdownAll here.
-        MultiThreadedHttpConnectionManager.shutdownAll();
+        // TODO - This action need be changed according to current HTTPClient.
+        String clientVersion = getHTTPClientVersion();
+        if (clientVersion != null
+                && HTTPTransportConstants.HTTP_CLIENT_4_X_VERSION.equals(clientVersion)) {
+            // TODO - Handle for HTTPClient 4
+        } else {
+            MultiThreadedHttpConnectionManager.shutdownAll();
+        }
+        
+    }
+
+    private String getHTTPClientVersion() {
+        Object version = configContext.getProperty(HTTPTransportConstants.HTTP_CLIENT_VERSION);
+        if (version != null) {
+            return String.valueOf(version);
+        }
+        return null;
     }
 
     /**
@@ -877,6 +894,7 @@ public class AxisServlet extends HttpServlet {
             }
 
         }
+        
 
     }
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java b/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
index edb7d99..4181a56 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
@@ -31,11 +31,10 @@ import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.axis2.transport.MessageFormatter;
 import org.apache.axis2.transport.OutTransportInfo;
-import org.apache.axis2.transport.TransportSender;
 import org.apache.axis2.transport.TransportUtils;
+import org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl;
 import org.apache.axis2.transport.http.server.AxisHttpResponse;
 import org.apache.axis2.util.JavaUtils;
-import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -51,8 +50,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.zip.GZIPOutputStream;
 
-public class CommonsHTTPTransportSender extends AbstractHandler implements
-        TransportSender {
+public class CommonsHTTPTransportSender extends AbstractHandler implements HTTPTransportSender {
     /**
      * The {@link TransportOutDescription} object received by the call to
      * {@link #init(ConfigurationContext, TransportOutDescription)}.
@@ -80,20 +78,22 @@ public class CommonsHTTPTransportSender extends AbstractHandler implements
     private int connectionTimeout = HTTPConstants.DEFAULT_CONNECTION_TIMEOUT;
 
     public void cleanup(MessageContext msgContext) throws AxisFault {
-        HttpMethod httpMethod = (HttpMethod) msgContext.getProperty(HTTPConstants.HTTP_METHOD);
-
-        if (httpMethod != null) {
-            // TODO : Don't do this if we're not on the right thread! Can we confirm?
-            log.trace("cleanup() releasing connection for " + httpMethod);
-
-            httpMethod.releaseConnection();
-            msgContext.removeProperty(HTTPConstants.HTTP_METHOD); // guard against multiple calls
-        }
+        
+            HttpMethod httpMethod = (HttpMethod) msgContext.getProperty(HTTPConstants.HTTP_METHOD);
+            if (httpMethod != null) {
+                // TODO : Don't do this if we're not on the right thread! Can we confirm?
+                log.trace("cleanup() releasing connection for " + httpMethod);
+
+                httpMethod.releaseConnection();
+                msgContext.removeProperty(HTTPConstants.HTTP_METHOD); // guard against multiple calls
+            }        
     }
 
     public void init(ConfigurationContext confContext,
                      TransportOutDescription transportOut) throws AxisFault {
         this.transportOut = transportOut;
+        //Set HTTP client version
+        setHTTPClientVersion(confContext);
         
         // <parameter name="PROTOCOL">HTTP/1.0</parameter> or
         // <parameter name="PROTOCOL">HTTP/1.1</parameter> is
@@ -376,7 +376,7 @@ public class CommonsHTTPTransportSender extends AbstractHandler implements
             // select the Message Sender depending on the REST status
             AbstractHTTPSender sender;
 
-            sender = new HTTPSender();
+            sender = new HTTPSenderImpl();
 
             boolean chunked;
             if (messageContext.getProperty(HTTPConstants.CHUNKED) != null) {
@@ -403,10 +403,7 @@ public class CommonsHTTPTransportSender extends AbstractHandler implements
         } catch (MalformedURLException e) {
             log.debug(e);
             throw AxisFault.makeFault(e);
-        } catch (HttpException e) {
-            log.debug(e);
-            throw AxisFault.makeFault(e);
-        } catch (IOException e) {
+        }  catch (IOException e) {
             log.debug(e);
             throw AxisFault.makeFault(e);
         }
@@ -505,4 +502,10 @@ public class CommonsHTTPTransportSender extends AbstractHandler implements
 
         return soapActionString;
     }
+    
+    public void setHTTPClientVersion(ConfigurationContext configurationContext) {
+        configurationContext.setProperty(HTTPTransportConstants.HTTP_CLIENT_VERSION,
+                HTTPTransportConstants.HTTP_CLIENT_3_X_VERSION);
+    }
+    
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java b/modules/transport/http/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java
index d09ebad..828d226 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java
@@ -19,30 +19,18 @@
 
 package org.apache.axis2.transport.http;
 
-import org.apache.commons.httpclient.Header;
 
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
-public class CommonsTransportHeaders implements Map {
-    private Header[] headers;
+public abstract class CommonsTransportHeaders implements Map {  
 
     HashMap headerMap = null;
-
-    public CommonsTransportHeaders(Header[] headers) {
-        this.headers = headers;
-    }
-
-    private void init() {
-        headerMap = new HashMap();
-
-        for (int i = 0; i < headers.length; i++) {
-            headerMap.put(headers[i].getName(), headers[i].getValue());
-        }
-    }
-
+   
+    protected abstract void init();
+    
     public int size() {
         if (headerMap == null) {
             init();
@@ -125,4 +113,14 @@ public class CommonsTransportHeaders implements Map {
         }
         return headerMap.put(key, value);
     }
+
+    public HashMap getHeaderMap() {
+        return headerMap;
+    }
+
+    public void setHeaderMap(HashMap headerMap) {
+        this.headerMap = headerMap;
+    }
+    
+    
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java b/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java
index 1227004..118ffbf 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java
@@ -23,58 +23,17 @@ package org.apache.axis2.transport.http;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.transport.MessageFormatter;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.methods.DeleteMethod;
-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.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import java.io.IOException;
 import java.net.URL;
 
-public class HTTPSender extends AbstractHTTPSender {
+//TODO - It better if we can define these method in a interface move these into AbstractHTTPSender and get rid of this class.
+public abstract class HTTPSender extends AbstractHTTPSender {
 
     private static final Log log = LogFactory.getLog(HTTPSender.class);
-
-    public void send(MessageContext msgContext, URL url, String soapActionString)
-            throws IOException {
-
-        // execute the HtttpMethodBase - a connection manager can be given for
-        // handle multiple
-
-        String httpMethod =
-                (String) msgContext.getProperty(Constants.Configuration.HTTP_METHOD);
-
-        if ((httpMethod != null)) {
-
-            if (Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod)) {
-                this.sendViaGet(msgContext, url, soapActionString);
-
-                return;
-            } else if (Constants.Configuration.HTTP_METHOD_DELETE.equalsIgnoreCase(httpMethod)) {
-                this.sendViaDelete(msgContext, url, soapActionString);
-
-                return;
-            } else if (Constants.Configuration.HTTP_METHOD_PUT.equalsIgnoreCase(httpMethod)) {
-                this.sendViaPut(msgContext, url, soapActionString);
-
-                return;
-            }
-        }
-
-        this.sendViaPost(msgContext, url, soapActionString);
-    }
-
+    
     /**
      * Used to send a request via HTTP Get method
      *
@@ -83,39 +42,9 @@ public class HTTPSender extends AbstractHTTPSender {
      * @param soapActiionString - The soapAction string of the request
      * @throws AxisFault - Thrown in case an exception occurs
      */
-    private void sendViaGet(MessageContext msgContext, URL url, String soapActiionString)
-            throws AxisFault {
-
-        GetMethod getMethod = new GetMethod();
-        HttpClient httpClient = getHttpClient(msgContext);
-        MessageFormatter messageFormatter =
-                populateCommonProperties(msgContext, url, getMethod, httpClient, soapActiionString);
-
-        // Need to have this here because we can have soap action when using the soap response MEP
-        String soapAction =
-                messageFormatter.formatSOAPAction(msgContext, format, soapActiionString);
-
-        if (soapAction != null) {
-            getMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
-        }
-        try {
-            executeMethod(httpClient, msgContext, url, getMethod);
-            handleResponse(msgContext, getMethod);
-        } catch (IOException e) {
-            log.info("Unable to sendViaGet to url[" + url + "]", e);
-            throw AxisFault.makeFault(e);
-        } finally {
-            cleanup(msgContext, getMethod);
-        }
-    }
-
-    private void cleanup(MessageContext msgContext, HttpMethod method) {
-        if (msgContext.isPropertyTrue(HTTPConstants.AUTO_RELEASE_CONNECTION)) {
-            log.trace("AutoReleasing " + method);
-            method.releaseConnection();
-        }
-    }
-
+    protected abstract void sendViaGet(MessageContext msgContext, URL url, String soapActiionString)
+            throws AxisFault;
+    
     /**
      * Used to send a request via HTTP Delete Method
      *
@@ -124,24 +53,8 @@ public class HTTPSender extends AbstractHTTPSender {
      * @param soapActiionString - The soapAction string of the request
      * @throws AxisFault - Thrown in case an exception occurs
      */
-    private void sendViaDelete(MessageContext msgContext, URL url, String soapActiionString)
-            throws AxisFault {
-
-        DeleteMethod deleteMethod = new DeleteMethod();
-        HttpClient httpClient = getHttpClient(msgContext);
-        populateCommonProperties(msgContext, url, deleteMethod, httpClient, soapActiionString);
-
-        try {
-            executeMethod(httpClient, msgContext, url, deleteMethod);
-            handleResponse(msgContext, deleteMethod);
-        } catch (IOException e) {
-            log.info("Unable to sendViaDelete to url[" + url + "]", e);
-            throw AxisFault.makeFault(e);
-        } finally {
-            cleanup(msgContext, deleteMethod);
-        }
-    }
-
+    protected abstract void sendViaDelete(MessageContext msgContext, URL url, String soapActiionString)
+            throws AxisFault; 
     /**
      * Used to send a request via HTTP Post Method
      *
@@ -150,55 +63,9 @@ public class HTTPSender extends AbstractHTTPSender {
      * @param soapActionString - The soapAction string of the request
      * @throws AxisFault - Thrown in case an exception occurs
      */
-    private void sendViaPost(MessageContext msgContext, URL url,
-                             String soapActionString) throws AxisFault {
-
-
-        HttpClient httpClient = getHttpClient(msgContext);
-
-/*  What's up with this, it never gets used anywhere?? --Glen
-        String charEncoding =
-                (String) msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
-
-        if (charEncoding == null) {
-            charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
-        }
-*/
-
-        PostMethod postMethod = new PostMethod();
-        if (log.isTraceEnabled()) {
-            log.trace(Thread.currentThread() + " PostMethod " + postMethod + " / " + httpClient);
-        }
-        MessageFormatter messageFormatter =
-                populateCommonProperties(msgContext, url, postMethod, httpClient, soapActionString);
+    protected abstract void sendViaPost(MessageContext msgContext, URL url,
+                             String soapActionString) throws AxisFault;
 
-        postMethod.setRequestEntity(new AxisRequestEntity(messageFormatter,
-                                                          msgContext, format, soapActionString,
-                                                          chunked, isAllowedRetry));
-
-        if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) {
-            postMethod.setContentChunked(true);
-        }
-
-        String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString);
-
-        if (soapAction != null) {
-            postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
-        }
-
-        /*
-         *   main excecution takes place..
-         */
-        try {
-            executeMethod(httpClient, msgContext, url, postMethod);
-            handleResponse(msgContext, postMethod);
-        } catch (IOException e) {
-            log.info("Unable to sendViaPost to url[" + url + "]", e);
-            throw AxisFault.makeFault(e);
-        } finally {
-            cleanup(msgContext, postMethod);
-        }
-    }
 
     /**
      * Used to send a request via HTTP Put Method
@@ -208,51 +75,10 @@ public class HTTPSender extends AbstractHTTPSender {
      * @param soapActionString - The soapAction string of the request
      * @throws AxisFault - Thrown in case an exception occurs
      */
-    private void sendViaPut(MessageContext msgContext, URL url,
-                            String soapActionString) throws AxisFault {
-
-
-        HttpClient httpClient = getHttpClient(msgContext);
-
-/*  Same deal - this value never gets used, why is it here? --Glen
-        String charEncoding =
-                (String) msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
-
-        if (charEncoding == null) {
-            charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
-        }
-*/
+    protected abstract void sendViaPut(MessageContext msgContext, URL url,
+                            String soapActionString) throws AxisFault;
 
-        PutMethod putMethod = new PutMethod();
-        MessageFormatter messageFormatter =
-                populateCommonProperties(msgContext, url, putMethod, httpClient, soapActionString);
-
-        putMethod.setRequestEntity(new AxisRequestEntity(messageFormatter,
-                                                         msgContext, format, soapActionString,
-                                                         chunked, isAllowedRetry));
-
-        if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) {
-            putMethod.setContentChunked(true);
-        }
-
-        String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString);
-        if (soapAction != null) {
-            putMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
-        }
-
-        /*
-         *   main excecution takes place..
-         */
-        try {
-            executeMethod(httpClient, msgContext, url, putMethod);
-            handleResponse(msgContext, putMethod);
-        } catch (IOException e) {
-            log.info("Unable to sendViaPut to url[" + url + "]", e);
-            throw AxisFault.makeFault(e);
-        } finally {
-            cleanup(msgContext, putMethod);
-        }
-    }
+     
 
     /**
      * Used to handle the HTTP Response
@@ -261,55 +87,40 @@ public class HTTPSender extends AbstractHTTPSender {
      * @param method     - The HTTP method used
      * @throws IOException - Thrown in case an exception occurs
      */
-    private void handleResponse(MessageContext msgContext,
-                                HttpMethodBase method) throws IOException {
-        int statusCode = method.getStatusCode();
-        log.trace("Handling response - " + statusCode);
-        if (statusCode == HttpStatus.SC_OK) {
-            // Save the HttpMethod so that we can release the connection when cleaning up
-            msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
-            processResponse(method, msgContext);
-        } else if (statusCode == HttpStatus.SC_ACCEPTED) {
-        	/* When an HTTP 202 Accepted code has been received, this will be the case of an execution 
-        	 * of an in-only operation. In such a scenario, the HTTP response headers should be returned,
-        	 * i.e. session cookies. */
-        	obtainHTTPHeaderInformation(method, msgContext);
-        	// Since we don't expect any content with a 202 response, we must release the connection
-        	method.releaseConnection();
-        } else if (statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR ||
-                statusCode == HttpStatus.SC_BAD_REQUEST) {
-            // Save the HttpMethod so that we can release the connection when cleaning up
-            msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
-            Header contenttypeHeader =
-                    method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
-            String value = null;
-            if (contenttypeHeader != null) {
-                value = contenttypeHeader.getValue();
-            }
-             OperationContext opContext = msgContext.getOperationContext();
-            if(opContext!=null){
-                MessageContext inMessageContext =
-                        opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-                if(inMessageContext!=null){
-                    inMessageContext.setProcessingFault(true);
-                }
-            }
-            if (value != null) {
+    protected abstract void handleResponse(MessageContext msgContext,
+                                Object httpMethodBase) throws IOException;
+    
+    protected abstract void cleanup(MessageContext msgContext, Object httpMethod);
+    
+    
 
-                processResponse(method, msgContext);
-            }
-            
-            if (org.apache.axis2.util.Utils.isClientThreadNonBlockingPropertySet(msgContext)) {
-            	 throw new AxisFault(Messages.getMessage("transportError",
-                         String.valueOf(statusCode),
-                         method.getStatusText()));
+    public void send(MessageContext msgContext, URL url, String soapActionString)
+            throws IOException {
+
+        // execute the HtttpMethodBase - a connection manager can be given for
+        // handle multiple
+
+        String httpMethod =
+                (String) msgContext.getProperty(Constants.Configuration.HTTP_METHOD);
+
+        if ((httpMethod != null)) {
+
+            if (Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod)) {
+                this.sendViaGet(msgContext, url, soapActionString);
+
+                return;
+            } else if (Constants.Configuration.HTTP_METHOD_DELETE.equalsIgnoreCase(httpMethod)) {
+                this.sendViaDelete(msgContext, url, soapActionString);
+
+                return;
+            } else if (Constants.Configuration.HTTP_METHOD_PUT.equalsIgnoreCase(httpMethod)) {
+                this.sendViaPut(msgContext, url, soapActionString);
+
+                return;
             }
-        } else {
-            // Since we don't process the response, we must release the connection immediately
-            method.releaseConnection();
-            throw new AxisFault(Messages.getMessage("transportError",
-                                                    String.valueOf(statusCode),
-                                                    method.getStatusText()));
         }
-    }
+
+        this.sendViaPost(msgContext, url, soapActionString);
+    }    
+       
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/HttpTransportProperties.java b/modules/transport/http/src/org/apache/axis2/transport/http/HttpTransportProperties.java
index 25c58bf..01f7376 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/HttpTransportProperties.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/HttpTransportProperties.java
@@ -19,48 +19,36 @@
 
 package org.apache.axis2.transport.http;
 
-import org.apache.commons.httpclient.HttpVersion;
-import org.apache.commons.httpclient.auth.AuthPolicy;
-import org.apache.commons.httpclient.auth.AuthScope;
-
-import java.util.List;
 import java.util.Properties;
 
 /**
  * Utility bean for setting transport properties in runtime.
  */
-public class HttpTransportProperties {
-    protected boolean chunked;
-    protected HttpVersion httpVersion;
+public abstract class HttpTransportProperties {
+    
+    protected boolean chunked;    
     protected String protocol;
-
-    public HttpTransportProperties() {
-    }
+       
+    public abstract void setHttpVersion(Object httpVerion);
+    
+    public abstract Object getHttpVersion();
 
     public boolean getChunked() {
         return chunked;
     }
-
-    public HttpVersion getHttpVersion() {
-        return httpVersion;
-    }
-
+    
     public String getProtocol() {
         return protocol;
     }
 
     public void setChunked(boolean chunked) {
         this.chunked = chunked;
-    }
-
-    public void setHttpVersion(HttpVersion httpVerion) {
-        this.httpVersion = httpVerion;
-    }
+    }  
 
     public void setProtocol(String protocol) {
         this.protocol = protocol;
     }
-
+    
     public static class ProxyProperties {
         protected int proxyPort = -1;
         protected String domain = null;
@@ -112,109 +100,7 @@ public class HttpTransportProperties {
         }
     }
 
-    /*
-    This class is responsible for holding all the necessary information needed for NTML, Digest
-    and Basic Authentication. Authentication itself is handled by httpclient. User doesn't need to
-    warry about what authentication mechanism it uses. Axis2 uses httpclinet's default authentication
-    patterns.
-    */
-    public static class Authenticator {
-        /*host that needed to be authenticated with*/
-        private String host;
-        /*port of the host that needed to be authenticated with*/
-        private int port = AuthScope.ANY_PORT;
-        /*Realm for authentication scope*/
-        private String realm = AuthScope.ANY_REALM;
-        /*Domain needed by NTCredentials for NT Domain*/
-        private String domain;
-        /*User for authenticate*/
-        private String username;
-        /*Password of the user for authenticate*/
-        private String password;
-        /* Switch to use preemptive authentication or not*/
-        private boolean preemptive = false;
-        /* if Authentication scheme needs retry just turn on the following flag */
-        private boolean allowedRetry = false;
-        /* Changing the priorty or adding a custom AuthPolicy*/
-        private List authSchemes;
-
-        /* Default Auth Schems*/
-        public static final String NTLM = AuthPolicy.NTLM;
-        public static final String DIGEST = AuthPolicy.DIGEST;
-        public static final String BASIC = AuthPolicy.BASIC;
-
-        public String getHost() {
-            return host;
-        }
-
-        public void setHost(String host) {
-            this.host = host;
-        }
-
-        public int getPort() {
-            return port;
-        }
-
-        public void setPort(int port) {
-            this.port = port;
-        }
-
-        public String getRealm() {
-            return realm;
-        }
-
-        public void setRealm(String realm) {
-            this.realm = realm;
-        }
-
-        public String getUsername() {
-            return username;
-        }
-
-        public void setUsername(String username) {
-            this.username = username;
-        }
-
-        public String getPassword() {
-            return password;
-        }
-
-        public void setPassword(String password) {
-            this.password = password;
-        }
-
-        public void setPreemptiveAuthentication(boolean preemptive) {
-            this.preemptive = preemptive;
-        }
-
-        public boolean getPreemptiveAuthentication() {
-            return this.preemptive;
-        }
-
-        public String getDomain() {
-            return domain;
-        }
-
-        public void setDomain(String domain) {
-            this.domain = domain;
-        }
-
-        public void setAuthSchemes(List authSchemes) {
-            this.authSchemes = authSchemes;
-        }
-
-        public List getAuthSchemes() {
-            return this.authSchemes;
-        }
-
-        public void setAllowedRetry(boolean allowedRetry) {
-            this.allowedRetry = allowedRetry;
-        }
-
-        public boolean isAllowedRetry() {
-            return this.allowedRetry;
-        }
-    }
+   
 
     /**
      * @deprecated org.apache.axis2.transport.http.HttpTransportProperties.MailProperties has been
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity.java b/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity.java
index bca0588..6410584 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity.java
@@ -23,7 +23,6 @@ import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
-import org.apache.commons.httpclient.methods.RequestEntity;
 
 import javax.xml.stream.FactoryConfigurationError;
 import javax.xml.stream.XMLStreamException;
@@ -31,7 +30,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 
-public class RESTRequestEntity implements RequestEntity {
+public abstract class RESTRequestEntity {
     private byte[] bytes;
     private String charSetEnc;
     private boolean chunked;
@@ -115,7 +114,7 @@ public class RESTRequestEntity implements RequestEntity {
         }
     }
 
-    public String getContentType() {
+    public String getContentTypeAsString() {
         String encoding = format.getCharSetEncoding();
         String contentType = format.getContentType();
         if (encoding != null) {
@@ -133,4 +132,61 @@ public class RESTRequestEntity implements RequestEntity {
     public boolean isRepeatable() {
         return true;
     }
+
+    public byte[] getBytes() {
+        return bytes;
+    }
+
+    public void setBytes(byte[] bytes) {
+        this.bytes = bytes;
+    }
+
+    public String getCharSetEnc() {
+        return charSetEnc;
+    }
+
+    public void setCharSetEnc(String charSetEnc) {
+        this.charSetEnc = charSetEnc;
+    }
+
+    public boolean isChunked() {
+        return chunked;
+    }
+
+    public void setChunked(boolean chunked) {
+        this.chunked = chunked;
+    }
+
+    public OMElement getElement() {
+        return element;
+    }
+
+    public void setElement(OMElement element) {
+        this.element = element;
+    }
+
+    public MessageContext getMsgCtxt() {
+        return msgCtxt;
+    }
+
+    public void setMsgCtxt(MessageContext msgCtxt) {
+        this.msgCtxt = msgCtxt;
+    }
+
+    public String getSoapActionString() {
+        return soapActionString;
+    }
+
+    public void setSoapActionString(String soapActionString) {
+        this.soapActionString = soapActionString;
+    }
+
+    public OMOutputFormat getFormat() {
+        return format;
+    }
+
+    public void setFormat(OMOutputFormat format) {
+        this.format = format;
+    }    
+    
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java b/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
index 81a3c6e..434b127 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
@@ -19,12 +19,10 @@
 
 package org.apache.axis2.transport.http;
 
-import org.apache.commons.httpclient.methods.RequestEntity;
-
 import java.io.IOException;
 import java.io.OutputStream;
 
-public class RESTRequestEntity2 implements RequestEntity {
+public abstract class RESTRequestEntity2 {
     private String contentType;
     private String postRequestBody;
 
@@ -41,11 +39,25 @@ public class RESTRequestEntity2 implements RequestEntity {
         return this.postRequestBody.getBytes().length;
     }
 
-    public String getContentType() {
+    public String getContentTypeAsString() {
         return this.contentType;
     }
 
     public boolean isRepeatable() {
         return true;
     }
+   
+
+    public void setContentType(String contentType) {
+        this.contentType = contentType;
+    }
+
+    public String getPostRequestBody() {
+        return postRequestBody;
+    }
+
+    public void setPostRequestBody(String postRequestBody) {
+        this.postRequestBody = postRequestBody;
+    }
+    
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/util/HTTPProxyConfigurationUtil.java b/modules/transport/http/src/org/apache/axis2/transport/http/util/HTTPProxyConfigurationUtil.java
index a163450..dcd7b90 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/util/HTTPProxyConfigurationUtil.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/util/HTTPProxyConfigurationUtil.java
@@ -42,6 +42,7 @@ import java.util.StringTokenizer;
 /**
  * Contains utility functions used when configuring HTTP Proxy for HTTP Sender.
  */
+@Deprecated
 public class HTTPProxyConfigurationUtil {
     private static Log log = LogFactory.getLog(HTTPProxyConfigurationUtil.class);
 
diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderClientSideTest.java b/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderClientSideTest.java
index 658f5ca..671f49e 100644
--- a/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderClientSideTest.java
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderClientSideTest.java
@@ -11,6 +11,7 @@ import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.transport.OutTransportInfo;
+import org.apache.axis2.transport.http.impl.httpclient3.HTTPClient3TransportSender;
 import org.apache.axis2.transport.http.mock.MockAxisHttpResponse;
 import org.apache.axis2.transport.http.mock.MockHTTPResponse;
 import org.apache.axis2.transport.http.mock.server.AbstractHTTPServerTest;
@@ -31,7 +32,7 @@ public class CommonsHTTPTransportSenderClientSideTest extends AbstractHTTPServer
         // client hence ignore the processing of response at client side.
         try {
             httpResponse = (MockAxisHttpResponse) CommonsHTTPTransportSenderTest.configAndRun(
-                    httpResponse, (OutTransportInfo) httpResponse, "http://localhost:" + port);
+                    httpResponse, (OutTransportInfo) httpResponse, "http://localhost:" + port,  new HTTPClient3TransportSender());
 
         } catch (Exception e) {
         }
diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderTest.java b/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderTest.java
index ec07b69..e3820bd 100644
--- a/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderTest.java
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/CommonsHTTPTransportSenderTest.java
@@ -54,14 +54,16 @@ import org.apache.http.ProtocolVersion;
 import org.apache.http.RequestLine;
 import org.apache.http.message.BasicRequestLine;
 
-public class CommonsHTTPTransportSenderTest extends TestCase  {
+public abstract class CommonsHTTPTransportSenderTest extends TestCase  {
+    
+    protected abstract TransportSender getTransportSender();
 
     public void testInvokeWithServletBasedOutTransportInfo() throws Exception {
         MockHTTPResponse httpResponse = new MockHttpServletResponse();
         ServletBasedOutTransportInfo info = new ServletBasedOutTransportInfo(
                 (HttpServletResponse) httpResponse);
         SOAPEnvelope envelope = getEnvelope();
-        httpResponse = configAndRun(httpResponse, info, null);
+        httpResponse = configAndRun(httpResponse, info, null, getTransportSender());
 
         assertEquals("Not the expected Header value", "application/xml", httpResponse.getHeaders()
                 .get("Content-Type"));
@@ -76,7 +78,7 @@ public class CommonsHTTPTransportSenderTest extends TestCase  {
         MockHTTPResponse httpResponse = new MockAxisHttpResponse(line);
         SOAPEnvelope envelope = getEnvelope();
         httpResponse = (MockAxisHttpResponse) configAndRun(httpResponse,
-                (OutTransportInfo) httpResponse, null);
+                (OutTransportInfo) httpResponse, null, getTransportSender());
 
         assertEquals("Not the expected Header value", "application/xml", httpResponse.getHeaders()
                 .get("Content-Type"));
@@ -87,7 +89,7 @@ public class CommonsHTTPTransportSenderTest extends TestCase  {
     }
 
     public void testCleanup() throws AxisFault {
-        TransportSender sender = new CommonsHTTPTransportSender();
+        TransportSender sender = getTransportSender();
         MessageContext msgContext = new MessageContext();
         HttpMethod httpMethod = new GetMethod();
         msgContext.setProperty(HTTPConstants.HTTP_METHOD, httpMethod);
@@ -102,13 +104,13 @@ public class CommonsHTTPTransportSenderTest extends TestCase  {
         ConfigurationContext confContext = ConfigurationContextFactory
                 .createEmptyConfigurationContext();
         TransportOutDescription transportOut = new TransportOutDescription("http");
-        TransportSender sender = new CommonsHTTPTransportSender();
+        TransportSender sender = getTransportSender();
         sender.init(confContext, transportOut);
 
     }
 
     public static MockHTTPResponse configAndRun(MockHTTPResponse outResponse,
-            OutTransportInfo outTransportInfo, String epr) throws Exception {
+            OutTransportInfo outTransportInfo, String epr, TransportSender sender) throws Exception {
         MockHTTPResponse response = outResponse;
         ConfigurationContext confContext = ConfigurationContextFactory
                 .createEmptyConfigurationContext();
@@ -116,8 +118,7 @@ public class CommonsHTTPTransportSenderTest extends TestCase  {
         Parameter param = new Parameter(HTTPConstants.OMIT_SOAP_12_ACTION, false);
         SOAPEnvelope envelope = getEnvelope();
         MessageContext msgContext = new MessageContext();
-
-        TransportSender sender = new CommonsHTTPTransportSender();
+        
         transportOut.addParameter(param);
         // create dummy SOAPEnvelope
         msgContext.setEnvelope(envelope);
diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
index ad7d9d0..8221b4a 100644
--- a/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
@@ -35,9 +35,11 @@ import org.apache.axis2.transport.http.mock.server.AbstractHTTPServerTest;
 /**
  * The Class HTTPSenderTest.
  */
-public class HTTPSenderTest extends AbstractHTTPServerTest {
+public abstract class HTTPSenderTest extends AbstractHTTPServerTest {
    
     private HTTPSender httpSender;
+    
+    protected abstract HTTPSender getHTTPSender();
 
     /**
      * Send via http.
@@ -51,7 +53,7 @@ public class HTTPSenderTest extends AbstractHTTPServerTest {
      */
     private void sendViaHTTP(String httpMethod, String soapAction, String address, boolean rest)
             throws IOException, MessagingException {
-        httpSender = new HTTPSender();
+        httpSender = getHTTPSender();
         MessageContext msgContext = new MessageContext();
         ConfigurationContext configContext = ConfigurationContextFactory
                 .createEmptyConfigurationContext();
@@ -66,7 +68,7 @@ public class HTTPSenderTest extends AbstractHTTPServerTest {
         httpSender.send(msgContext, url, soapAction);
        
 
-    }
+    }   
 
     /**
      * Test send via get.
diff --git a/modules/transport/local/pom.xml b/modules/transport/local/pom.xml
index 19dff9f..0ef2fa6 100644
--- a/modules/transport/local/pom.xml
+++ b/modules/transport/local/pom.xml
@@ -33,9 +33,9 @@
     <packaging>bundle</packaging>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/transport/local</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/transport/local</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/local</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/local</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/local</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/local</url>
     </scm>
     <build>
         <sourceDirectory>src</sourceDirectory>
diff --git a/modules/webapp/pom.xml b/modules/webapp/pom.xml
index 2d7408b..e809b26 100644
--- a/modules/webapp/pom.xml
+++ b/modules/webapp/pom.xml
@@ -30,9 +30,9 @@
     <name>Apache Axis2 - Web Application module</name>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/webapp</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/webapp</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/webapp</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/webapp</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/webapp</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/webapp</url>
     </scm>
     <dependencies>
         <dependency>
diff --git a/modules/xmlbeans/pom.xml b/modules/xmlbeans/pom.xml
index 41c6bf5..7177793 100644
--- a/modules/xmlbeans/pom.xml
+++ b/modules/xmlbeans/pom.xml
@@ -51,9 +51,9 @@
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/xmlbeans</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/xmlbeans</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/xmlbeans</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/xmlbeans</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318/modules/xmlbeans</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/xmlbeans</url>
     </scm>
     <build>
         <resources>
diff --git a/pom.xml b/pom.xml
index 8c49221..1399c35 100644
--- a/pom.xml
+++ b/pom.xml
@@ -550,9 +550,9 @@
         </contributor>
     </contributors>
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk</developerConnection>
-        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/branches/AXIS2-4318</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318</url>
     </scm>
     <properties>
         <!-- This variable is used in some Xdocs and is substituted using Velocity. Note that


[axis-axis2-java-core] 05/15: AXIS2-4318 - Added HTTPClient 4.x into Import-Package.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit 730ee5d44dd9cda033af20f716ec655791dde1a8
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Thu Jan 12 09:18:51 2012 +0000

    AXIS2-4318 - Added HTTPClient 4.x into Import-Package.
---
 modules/osgi/pom.xml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/modules/osgi/pom.xml b/modules/osgi/pom.xml
index b3affd9..7c1530c 100644
--- a/modules/osgi/pom.xml
+++ b/modules/osgi/pom.xml
@@ -117,6 +117,8 @@
                             org.apache.axiom.*,
                             org.apache.commons.fileupload.*,
                             org.apache.commons.httpclient.*,
+                            org.apache.http.client.*,
+                            org.apache.http.auth.*,
                             org.apache.commons.lang;resolution:=optional,
                             org.apache.commons.logging,
                             org.apache.http;resolution:=optional,


[axis-axis2-java-core] 11/15: AXIS2-4318 - Applied patch AXIS2-4318_02.patch.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit 9b7b802eb304069e26c288636398166f131d32ff
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Tue Apr 24 07:06:32 2012 +0000

     AXIS2-4318 - Applied patch AXIS2-4318_02.patch.
---
 modules/parent/pom.xml                             |  6 +++
 modules/transport/http/pom.xml                     |  8 ++++
 .../httpclient4/HTTPClient4TransportSender.java    | 55 ++++++++++++++++++++++
 .../httpclient4/HttpTransportPropertiesImpl.java   |  3 --
 .../http/HTTPClient4TransportSenderTest.java       | 47 ++++++++++++++++++
 5 files changed, 116 insertions(+), 3 deletions(-)

diff --git a/modules/parent/pom.xml b/modules/parent/pom.xml
index c523281..d49913c 100644
--- a/modules/parent/pom.xml
+++ b/modules/parent/pom.xml
@@ -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>
diff --git a/modules/transport/http/pom.xml b/modules/transport/http/pom.xml
index 6d1cfde..1c8971f 100644
--- a/modules/transport/http/pom.xml
+++ b/modules/transport/http/pom.xml
@@ -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>
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java
new file mode 100644
index 0000000..c394437
--- /dev/null
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPClient4TransportSender.java
@@ -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);
+    }
+
+
+}
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HttpTransportPropertiesImpl.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HttpTransportPropertiesImpl.java
index dd34240..3b8fcf4 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HttpTransportPropertiesImpl.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HttpTransportPropertiesImpl.java
@@ -56,7 +56,6 @@ public class HttpTransportPropertiesImpl extends HttpTransportProperties {
         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 extends HttpTransportProperties {
                 return AuthPolicy.NTLM;
             } else if (DIGEST.equals(scheme)) {
                 return AuthPolicy.DIGEST;
-            } else if (SPNEGO.equals(scheme)) {
-                return AuthPolicy.SPNEGO;
             }
             return null;
         }
diff --git a/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4TransportSenderTest.java b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4TransportSenderTest.java
new file mode 100644
index 0000000..d3170e6
--- /dev/null
+++ b/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4TransportSenderTest.java
@@ -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));
+    }
+}


[axis-axis2-java-core] 06/15: AXIS2-4318 - Refactoring existing codes.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit 69270e8661685385b29d77d15f183f4c16efbb29
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Thu Jan 12 09:33:53 2012 +0000

    AXIS2-4318 -  Refactoring existing codes.
---
 .../axis2/transport/http/AbstractHTTPSender.java   | 689 +--------------------
 .../axis2/transport/http/AxisRequestEntity.java    |  15 +-
 .../apache/axis2/transport/http/AxisServlet.java   |  18 +-
 .../transport/http/CommonsHTTPTransportSender.java |  39 +-
 .../transport/http/CommonsTransportHeaders.java    |  30 +-
 .../axis2/transport/http/HTTPAuthenticator.java    | 107 ++++
 .../apache/axis2/transport/http/HTTPSender.java    | 281 ++-------
 .../transport/http/HTTPTransportConstants.java     |  52 ++
 ...equestEntity2.java => HTTPTransportSender.java} |  30 +-
 .../transport/http/HttpTransportProperties.java    | 136 +---
 .../axis2/transport/http/RESTRequestEntity.java    |  62 +-
 .../axis2/transport/http/RESTRequestEntity2.java   |  20 +-
 .../impl/httpclient3/AxisRequestEntityImpl.java    |  50 ++
 .../httpclient3/HTTPClient3TransportSender.java    |  42 ++
 .../httpclient3/HTTPProxcyConfigurator.java}       | 274 ++++----
 .../httpclient3/HTTPSenderImpl.java}               | 680 +++++++++++++-------
 .../httpclient3/HTTPTransportHeaders.java}         |  34 +-
 .../httpclient3/HttpTransportPropertiesImpl.java   |  90 +++
 .../httpclient3/RESTRequestEntity2Impl.java}       |  28 +-
 .../httpclient3/RESTRequestEntityImpl.java}        |  32 +-
 .../http/util/HTTPProxyConfigurationUtil.java      |   1 +
 21 files changed, 1179 insertions(+), 1531 deletions(-)

diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java b/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
index f02875a..09bd9c2 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
@@ -19,65 +19,27 @@
 
 package org.apache.axis2.transport.http;
 
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
+
+import java.io.IOException;
+import java.net.URL;
+
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.NamedValue;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.transport.MessageFormatter;
-import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.transport.http.util.HTTPProxyConfigurationUtil;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.commons.httpclient.Credentials;
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HeaderElement;
-import org.apache.commons.httpclient.HostConfiguration;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpConnectionManager;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.apache.commons.httpclient.HttpState;
-import org.apache.commons.httpclient.HttpVersion;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.NTCredentials;
-import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.auth.AuthPolicy;
-import org.apache.commons.httpclient.auth.AuthScope;
-import org.apache.commons.httpclient.params.HttpMethodParams;
-import org.apache.commons.httpclient.protocol.Protocol;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.http.protocol.HTTP;
 
-import javax.xml.namespace.QName;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.zip.GZIPInputStream;
+
+
 
 public abstract class AbstractHTTPSender {
-    protected static final String ANONYMOUS = "anonymous";
-    protected static final String PROXY_HOST_NAME = "proxy_host";
-    protected static final String PROXY_PORT = "proxy_port";
+    
     protected boolean chunked = false;
     protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
-    private static final Log log = LogFactory.getLog(AbstractHTTPSender.class);
-
-    protected static final String PROTOCOL_HTTP = "http";
-    protected static final String PROTOCOL_HTTPS = "https";
+    
+    private static final Log log = LogFactory.getLog(AbstractHTTPSender.class);   
 
     /**
      * proxydiscription
@@ -109,638 +71,13 @@ public abstract class AbstractHTTPSender {
                                 + " Can have values only HTTP/1.0 or HTTP/1.1");
             }
         }
-    }
-
-    /**
-     * Collect the HTTP header information and set them in the message context
-     *
-     * @param method HttpMethodBase from which to get information
-     * @param msgContext the MessageContext in which to place the information... OR NOT!
-     * @throws AxisFault if problems occur
-     */
-    protected void obtainHTTPHeaderInformation(HttpMethodBase method,
-                                               MessageContext msgContext) throws AxisFault {
-        // Set RESPONSE properties onto the REQUEST message context.  They will need to be copied off the request context onto
-        // the response context elsewhere, for example in the OutInOperationClient.
-        Map transportHeaders = new CommonsTransportHeaders(method.getResponseHeaders());
-        msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, transportHeaders);
-        msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE, new Integer(method.getStatusCode()));
-        Header header = method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
-
-        if (header != null) {
-            HeaderElement[] headers = header.getElements();
-            MessageContext inMessageContext = msgContext.getOperationContext().getMessageContext(
-                    WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-
-            Object contentType = header.getValue();
-            Object charSetEnc = null;
-
-            for (int i = 0; i < headers.length; i++) {
-                NameValuePair charsetEnc = headers[i].getParameterByName(
-                        HTTPConstants.CHAR_SET_ENCODING);
-                if (charsetEnc != null) {
-                    charSetEnc = charsetEnc.getValue();
-                }
-            }
-
-            if (inMessageContext != null) {
-                inMessageContext
-                        .setProperty(Constants.Configuration.CONTENT_TYPE, contentType);
-                inMessageContext
-                        .setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
-            } else {
-
-                // Transport details will be stored in a HashMap so that anybody interested can
-                // retrieve them
-                HashMap transportInfoMap = new HashMap();
-                transportInfoMap.put(Constants.Configuration.CONTENT_TYPE, contentType);
-                transportInfoMap.put(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
-
-                //the HashMap is stored in the outgoing message.
-                msgContext.setProperty(Constants.Configuration.TRANSPORT_INFO_MAP,
-                                       transportInfoMap);
-            }
-        }
-
-        String sessionCookie = null;
-        // Process old style headers first
-        Header[] cookieHeaders = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE);
-        String customCoookiId = (String) msgContext.getProperty(Constants.CUSTOM_COOKIE_ID);
-        for (int i = 0; i < cookieHeaders.length; i++) {
-            HeaderElement[] elements = cookieHeaders[i].getElements();
-            for (int e = 0; e < elements.length; e++) {
-                HeaderElement element = elements[e];
-                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) ||
-                        Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
-                    sessionCookie = processCookieHeader(element);
-                }
-                if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) {
-                    sessionCookie = processCookieHeader(element);
-                }
-            }
-        }
-        // Overwrite old style cookies with new style ones if present
-        cookieHeaders = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE2);
-        for (int i = 0; i < cookieHeaders.length; i++) {
-            HeaderElement[] elements = cookieHeaders[i].getElements();
-            for (int e = 0; e < elements.length; e++) {
-                HeaderElement element = elements[e];
-                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) ||
-                        Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
-                    sessionCookie = processCookieHeader(element);
-                }
-                if(customCoookiId!=null&&customCoookiId.equalsIgnoreCase(element.getName())){
-                    sessionCookie = processCookieHeader(element);
-                }
-            }
-        }
-
-        if (sessionCookie != null) {
-            msgContext.getServiceContext().setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
-        }
-    }
-
-    private String processCookieHeader(HeaderElement element) {
-        String cookie = element.getName() + "=" + element.getValue();
-        NameValuePair[] parameters =  element.getParameters();
-        for (int j = 0; parameters != null && j < parameters.length; j++) {
-            NameValuePair parameter = parameters[j];
-            cookie = cookie + "; " + parameter.getName() + "=" + parameter.getValue();
-        }
-        return cookie;
-    }
-
-    protected void processResponse(HttpMethodBase httpMethod,
-                                   MessageContext msgContext)
-            throws IOException {
-        obtainHTTPHeaderInformation(httpMethod, msgContext);
-
-        InputStream in = httpMethod.getResponseBodyAsStream();
-        if (in == null) {
-            throw new AxisFault(Messages.getMessage("canNotBeNull", "InputStream"));
-        }
-        Header contentEncoding =
-                httpMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_ENCODING);
-        if (contentEncoding != null) {
-            if (contentEncoding.getValue().
-                    equalsIgnoreCase(HTTPConstants.COMPRESSION_GZIP)) {
-                in = new GZIPInputStream(in);
-                // If the content-encoding is identity we can basically ignore it.
-            } else if (!"identity".equalsIgnoreCase(contentEncoding.getValue())) {
-                throw new AxisFault("HTTP :" + "unsupported content-encoding of '"
-                        + contentEncoding.getValue() + "' found");
-            }
-        }
-
-        OperationContext opContext = msgContext.getOperationContext();
-        if (opContext != null) {
-            opContext.setProperty(MessageContext.TRANSPORT_IN, in);
-        }
-    }
+    }       
 
     public abstract void send(MessageContext msgContext, URL url, String soapActionString)
-            throws IOException;
-
-    /**
-     * getting host configuration to support standard http/s, proxy and NTLM support
-     *
-     * @param client active HttpClient
-     * @param msgCtx active MessageContext
-     * @param targetURL the target URL
-     * @return a HostConfiguration set up with proxy information
-     * @throws AxisFault if problems occur
-     */
-    protected HostConfiguration getHostConfiguration(HttpClient client,
-                                                     MessageContext msgCtx,
-                                                     URL targetURL)throws AxisFault {
-
-        boolean isAuthenticationEnabled = isAuthenticationEnabled(msgCtx);
-        int port = targetURL.getPort();
-
-        String protocol = targetURL.getProtocol();
-        if (port == -1) {
-            if (PROTOCOL_HTTP.equals(protocol)) {
-                port = 80;
-            } else if (PROTOCOL_HTTPS.equals(protocol)) {
-                port = 443;
-            }
-
-        }
-
-        // to see the host is a proxy and in the proxy list - available in axis2.xml
-        HostConfiguration config = new HostConfiguration();
-
-        // one might need to set his own socket factory. Let's allow that case as well.
-        Protocol protocolHandler =
-                (Protocol)msgCtx.getOptions().getProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER);
-
-        // setting the real host configuration
-        // I assume the 90% case, or even 99% case will be no protocol handler case.
-        if (protocolHandler == null) {
-            config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
-        } else {
-            config.setHost(targetURL.getHost(), port, protocolHandler);
-        }
-
-        if (isAuthenticationEnabled) {
-            // Basic, Digest, NTLM and custom authentications.
-            this.setAuthenticationInfo(client, msgCtx, config);
-        }
-        // proxy configuration
-
-        if (HTTPProxyConfigurationUtil.isProxyEnabled(msgCtx, targetURL)) {
-            if(log.isDebugEnabled()){
-                log.debug("Configuring HTTP proxy.");
-            }
-            HTTPProxyConfigurationUtil.configure(msgCtx, client, config);
-        }
-
-        return config;
-    }
-
-    protected boolean isAuthenticationEnabled(MessageContext msgCtx) {
-        return (msgCtx.getProperty(HTTPConstants.AUTHENTICATE) != null);
-    }
-
-    /*
-    This will handle server Authentication, It could be either NTLM, Digest or Basic Authentication.
-    Apart from that user can change the priory or add a custom authentication scheme.
-    */
-    protected void setAuthenticationInfo(HttpClient agent,
-                                         MessageContext msgCtx,
-                                         HostConfiguration config) throws AxisFault {
-        HttpTransportProperties.Authenticator authenticator;
-        Object obj = msgCtx.getProperty(HTTPConstants.AUTHENTICATE);
-        if (obj != null) {
-            if (obj instanceof HttpTransportProperties.Authenticator) {
-                authenticator = (HttpTransportProperties.Authenticator) obj;
-
-                String username = authenticator.getUsername();
-                String password = authenticator.getPassword();
-                String host = authenticator.getHost();
-                String domain = authenticator.getDomain();
-
-                int port = authenticator.getPort();
-                String realm = authenticator.getRealm();
-
-                /* If retrying is available set it first */
-                isAllowedRetry = authenticator.isAllowedRetry();
-
-                Credentials creds;
-
-                HttpState tmpHttpState = null;
-                HttpState httpState = (HttpState)msgCtx.getProperty(HTTPConstants.CACHED_HTTP_STATE);
-                if (httpState != null) {
-                    tmpHttpState = httpState;
-                } else {
-                    tmpHttpState = agent.getState();
-                }
-                
-                agent.getParams()
-                        .setAuthenticationPreemptive(authenticator.getPreemptiveAuthentication());
-
-                if (host != null) {
-                    if (domain != null) {
-                        /*Credentials for NTLM Authentication*/
-                        creds = new NTCredentials(username, password, host, domain);
-                    } else {
-                        /*Credentials for Digest and Basic Authentication*/
-                        creds = new UsernamePasswordCredentials(username, password);
-                    }
-                    tmpHttpState.setCredentials(new AuthScope(host, port, realm), creds);
-                } else {
-                    if (domain != null) {
-                        /*Credentials for NTLM Authentication when host is ANY_HOST*/
-                        creds = new NTCredentials(username, password, AuthScope.ANY_HOST, domain);
-                        tmpHttpState.setCredentials(
-                                new AuthScope(AuthScope.ANY_HOST, port, realm), creds);
-                    } else {
-                        /*Credentials only for Digest and Basic Authentication*/
-                        creds = new UsernamePasswordCredentials(username, password);
-                        tmpHttpState.setCredentials(new AuthScope(AuthScope.ANY), creds);
-                    }
-                }
-                /* Customizing the priority Order */
-                List schemes = authenticator.getAuthSchemes();
-                if (schemes != null && schemes.size() > 0) {
-                    List authPrefs = new ArrayList(3);
-                    for (int i = 0; i < schemes.size(); i++) {
-                        if (schemes.get(i) instanceof AuthPolicy) {
-                            authPrefs.add(schemes.get(i));
-                            continue;
-                        }
-                        String scheme = (String) schemes.get(i);
-                        if (HttpTransportProperties.Authenticator.BASIC.equals(scheme)) {
-                            authPrefs.add(AuthPolicy.BASIC);
-                        } else if (HttpTransportProperties.Authenticator.NTLM.equals(scheme)) {
-                            authPrefs.add(AuthPolicy.NTLM);
-                        } else if (HttpTransportProperties.Authenticator.DIGEST.equals(scheme)) {
-                            authPrefs.add(AuthPolicy.DIGEST);
-                        }
-                    }
-                    agent.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY,
-                            authPrefs);
-                }
-
-            } else {
-                throw new AxisFault("HttpTransportProperties.Authenticator class cast exception");
-            }
-        }
-
-    }
-
-    /**
-     * Method used to copy all the common properties
-     *
-     * @param msgContext       - The messageContext of the request message
-     * @param url              - The target URL
-     * @param httpMethod       - The http method used to send the request
-     * @param httpClient       - The httpclient used to send the request
-     * @param soapActionString - The soap action atring of the request message
-     * @return MessageFormatter - The messageFormatter for the relavent request message
-     * @throws AxisFault - Thrown in case an exception occurs
-     */
-    protected MessageFormatter populateCommonProperties(MessageContext msgContext, URL url,
-                                                      HttpMethodBase httpMethod,
-                                                      HttpClient httpClient,
-                                                      String soapActionString)
-            throws AxisFault {
-
-        if (isAuthenticationEnabled(msgContext)) {
-            httpMethod.setDoAuthentication(true);
-        }
-
-        MessageFormatter messageFormatter = TransportUtils.getMessageFormatter(
-                msgContext);
-
-        url = messageFormatter.getTargetAddress(msgContext, format, url);
-
-        httpMethod.setPath(url.getPath());
-
-        httpMethod.setQueryString(url.getQuery());
-
-        httpMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
-                                    messageFormatter.getContentType(msgContext, format,
-                                                                    soapActionString));
-
-        httpMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url.getHost());
-
-        if (msgContext.getOptions() != null && msgContext.getOptions().isManageSession()) {
-            // setting the cookie in the out path
-            Object cookieString = msgContext.getProperty(HTTPConstants.COOKIE_STRING);
-
-            if (cookieString != null) {
-                StringBuffer buffer = new StringBuffer();
-                buffer.append(cookieString);
-                httpMethod.setRequestHeader(HTTPConstants.HEADER_COOKIE, buffer.toString());
-            }
-        }
-
-        if (httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)) {
-            httpClient.getParams().setVersion(HttpVersion.HTTP_1_0);
-        }
-        return messageFormatter;
-    }
-
-    /**
-     * This is used to get the dynamically set time out values from the
-     * message context. If the values are not available or invalid then
-     * the default values or the values set by the configuration will be used
-     *
-     * @param msgContext the active MessageContext
-     * @param httpClient
-     */
-    protected void initializeTimeouts(MessageContext msgContext, HttpClient httpClient) {
-        // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
-        // override the static config
-        Integer tempSoTimeoutProperty =
-                (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT);
-        Integer tempConnTimeoutProperty =
-                (Integer) msgContext
-                        .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
-        long timeout = msgContext.getOptions().getTimeOutInMilliSeconds();
-
-        if (tempConnTimeoutProperty != null) {
-            int connectionTimeout = tempConnTimeoutProperty.intValue();
-            // timeout for initial connection
-            httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(connectionTimeout);
-        } else {
-            // set timeout in client
-            if (timeout > 0) {
-                httpClient.getHttpConnectionManager().getParams().setConnectionTimeout((int) timeout);
-            }
-        }
-
-        if (tempSoTimeoutProperty != null) {
-            int soTimeout = tempSoTimeoutProperty.intValue();
-            // SO_TIMEOUT -- timeout for blocking reads
-            httpClient.getHttpConnectionManager().getParams().setSoTimeout(soTimeout);
-            httpClient.getParams().setSoTimeout(soTimeout);
-        } else {
-            // set timeout in client
-            if (timeout > 0) {
-                httpClient.getHttpConnectionManager().getParams().setSoTimeout((int) timeout);
-                httpClient.getParams().setSoTimeout((int) timeout);
-            }
-        }
-    }
-
-    /**
-     * This is used to get the dynamically set time out values from the
-     * message context. If the values are not available or invalid then
-     * the default values or the values set by the configuration will be used
-     *
-     * @param msgContext the active MessageContext
-     * @param httpMethod method
-     */
-    protected void setTimeouts(MessageContext msgContext, HttpMethod httpMethod) {
-        // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
-        // override the static config
-        Integer tempSoTimeoutProperty =
-                (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT);
-        Integer tempConnTimeoutProperty =
-                (Integer) msgContext
-                        .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
-        long timeout = msgContext.getOptions().getTimeOutInMilliSeconds();
-
-        if (tempConnTimeoutProperty != null) {
-            // timeout for initial connection
-            httpMethod.getParams().setParameter("http.connection.timeout",
-                    tempConnTimeoutProperty);
-        }
-
-        if (tempSoTimeoutProperty != null) {
-            // SO_TIMEOUT -- timeout for blocking reads
-            httpMethod.getParams().setSoTimeout(tempSoTimeoutProperty);
-        } else {
-            // set timeout in client
-            if (timeout > 0) {
-                httpMethod.getParams().setSoTimeout((int) timeout);
-            }
-        }
-    }
+            throws IOException;   
 
     public void setFormat(OMOutputFormat format) {
         this.format = format;
-    }
-
-    protected HttpClient getHttpClient(MessageContext msgContext) {
-        ConfigurationContext configContext = msgContext.getConfigurationContext();
-
-        HttpClient httpClient = (HttpClient) msgContext.getProperty(
-                HTTPConstants.CACHED_HTTP_CLIENT);
-
-        if (httpClient == null) {
-            httpClient = (HttpClient) configContext.getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
-        }
-
-        if (httpClient != null) {
-            return httpClient;
-        }
-
-        synchronized (this) {
-            httpClient = (HttpClient) msgContext.getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
-
-            if (httpClient == null) {
-                httpClient = (HttpClient) configContext.getProperty(
-                        HTTPConstants.CACHED_HTTP_CLIENT);
-            }
-
-            if (httpClient != null) {
-                return httpClient;
-            }
-
-            HttpConnectionManager connManager =
-                    (HttpConnectionManager) msgContext.getProperty(
-                            HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
-            if (connManager == null) {
-                connManager =
-                        (HttpConnectionManager) msgContext.getProperty(
-                                HTTPConstants.MUTTITHREAD_HTTP_CONNECTION_MANAGER);
-            }
-            if (connManager == null) {
-                // reuse HttpConnectionManager
-                synchronized (configContext) {
-                    connManager = (HttpConnectionManager) configContext.getProperty(
-                            HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
-                    if (connManager == null) {
-                        log.trace("Making new ConnectionManager");
-                        connManager = new MultiThreadedHttpConnectionManager();
-                        configContext.setProperty(
-                                HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER, connManager);
-                    }
-                }
-            }
-            /*
-             * Create a new instance of HttpClient since the way
-             * it is used here it's not fully thread-safe.
-             */
-            httpClient = new HttpClient(connManager);
-
-            // Set the default timeout in case we have a connection pool starvation to 30sec
-            httpClient.getParams().setConnectionManagerTimeout(30000);
-
-            // Get the timeout values set in the runtime
-            initializeTimeouts(msgContext, httpClient);
-
-            return httpClient;
-        }
-    }
-
-    protected void executeMethod(HttpClient httpClient, MessageContext msgContext, URL url,
-                                 HttpMethod method) throws IOException {
-        HostConfiguration config = this.getHostConfiguration(httpClient, msgContext, url);
-
-        // set the custom headers, if available
-        addCustomHeaders(method, msgContext);
-
-        // add compression headers if needed
-        if (msgContext.isPropertyTrue(HTTPConstants.MC_ACCEPT_GZIP)) {
-            method.addRequestHeader(HTTPConstants.HEADER_ACCEPT_ENCODING,
-                    HTTPConstants.COMPRESSION_GZIP);
-        }
-
-        if (msgContext.isPropertyTrue(HTTPConstants.MC_GZIP_REQUEST)) {
-            method.addRequestHeader(HTTPConstants.HEADER_CONTENT_ENCODING,
-                    HTTPConstants.COMPRESSION_GZIP);
-        }
-        
-        if (msgContext.getProperty(HTTPConstants.HTTP_METHOD_PARAMS) != null) {
-            HttpMethodParams params = (HttpMethodParams)msgContext
-                    .getProperty(HTTPConstants.HTTP_METHOD_PARAMS);
-            method.setParams(params);
-        }
-
-        String cookiePolicy = (String) msgContext.getProperty(HTTPConstants.COOKIE_POLICY);
-        if (cookiePolicy != null) {
-            method.getParams().setCookiePolicy(cookiePolicy);   
-        }
-        HttpState httpState = (HttpState)msgContext.getProperty(HTTPConstants.CACHED_HTTP_STATE);
-
-        setTimeouts(msgContext, method);
-
-        httpClient.executeMethod(config, method, httpState);
-    }
-
-    public void addCustomHeaders(HttpMethod method, MessageContext msgContext) {
-
-        boolean isCustomUserAgentSet = false;
-        // set the custom headers, if available
-        Object httpHeadersObj = msgContext.getProperty(HTTPConstants.HTTP_HEADERS);
-        if (httpHeadersObj != null) {
-            if (httpHeadersObj instanceof List) {
-                List httpHeaders = (List) httpHeadersObj;
-                for (int i = 0; i < httpHeaders.size(); i++) {
-                    NamedValue nv = (NamedValue) httpHeaders.get(i);
-                    if (nv != null) {
-                        Header header = new Header(nv.getName(), nv.getValue());
-                        if (HTTPConstants.HEADER_USER_AGENT.equals(header.getName())) {
-                            isCustomUserAgentSet = true;
-                        }
-                        method.addRequestHeader(header);
-                    }
-                }
-    
-            }
-            if (httpHeadersObj instanceof Map) {
-                Map httpHeaders = (Map) httpHeadersObj;
-                for (Iterator iterator = httpHeaders.entrySet().iterator(); iterator.hasNext();) {
-                    Map.Entry entry  = (Map.Entry) iterator.next();
-                    String key = (String) entry.getKey();
-                    String value = (String) entry.getValue();
-                    if (HTTPConstants.HEADER_USER_AGENT.equals(key)) {
-                        isCustomUserAgentSet = true;
-                    }
-                    method.addRequestHeader(key, value);
-                }
-            }
-        }
-
-        // we have to consider the TRANSPORT_HEADERS map as well
-        Map transportHeaders = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
-        if (transportHeaders != null) {
-            removeUnwantedHeaders(msgContext);
-
-            Set headerEntries = transportHeaders.entrySet();
-
-            for (Object headerEntry : headerEntries) {
-                if (headerEntry instanceof Map.Entry) {
-                    Header[] headers = method.getRequestHeaders();
-
-                    boolean headerAdded = false;
-                    for (Header header : headers) {
-                        if (header.getName() != null &&                                 
-                                header.getName().equals(((Map.Entry) headerEntry).getKey())) {
-                            headerAdded = true;
-                            break;
-                        }
-                    }
-
-                    if (!headerAdded) {
-                        method.addRequestHeader(((Map.Entry) headerEntry).getKey().toString(),
-                                ((Map.Entry) headerEntry).getValue().toString());
-                    }
-                }
-            }
-        }
-
-        if (!isCustomUserAgentSet) {
-            String userAgentString = getUserAgent(msgContext);
-            method.setRequestHeader(HTTPConstants.HEADER_USER_AGENT, userAgentString);
-        }
-
-    }
-
-
-    /**
-     * Remove unwanted headers from the transport headers map of outgoing request. These are headers which
-     * should be dictated by the transport and not the user. We remove these as these may get
-     * copied from the request messages
-     *
-     * @param msgContext the Axis2 Message context from which these headers should be removed
-     */
-    private void removeUnwantedHeaders(MessageContext msgContext) {
-        Map headers = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
-
-        if (headers == null || headers.isEmpty()) {
-            return;
-        }
-
-        Iterator iter = headers.keySet().iterator();
-        while (iter.hasNext()) {
-            String headerName = (String) iter.next();
-            if (HTTP.CONN_DIRECTIVE.equalsIgnoreCase(headerName) ||
-                HTTP.TRANSFER_ENCODING.equalsIgnoreCase(headerName) ||
-                HTTP.DATE_HEADER.equalsIgnoreCase(headerName) ||
-                HTTP.CONTENT_TYPE.equalsIgnoreCase(headerName) ||
-                HTTP.CONTENT_LEN.equalsIgnoreCase(headerName)) {
-                iter.remove();
-            }
-        }
-    }
-
-    private String getUserAgent(MessageContext messageContext) {
-        String userAgentString = "Axis2";
-        boolean locked = false;
-        if (messageContext.getParameter(HTTPConstants.USER_AGENT) != null) {
-            OMElement userAgentElement =
-                    messageContext.getParameter(HTTPConstants.USER_AGENT).getParameterElement();
-            userAgentString = userAgentElement.getText().trim();
-            OMAttribute lockedAttribute = userAgentElement.getAttribute(new QName("locked"));
-            if (lockedAttribute != null) {
-                if (lockedAttribute.getAttributeValue().equalsIgnoreCase("true")) {
-                    locked = true;
-                }
-            }
-        }
-        // Runtime overing part
-        if (!locked) {
-            if (messageContext.getProperty(HTTPConstants.USER_AGENT) != null) {
-                userAgentString = (String) messageContext.getProperty(HTTPConstants.USER_AGENT);
-            }
-        }
-
-        return userAgentString;
-    }
+    }  
     
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java b/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java
index 0de3084..8834def 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java
@@ -24,7 +24,6 @@ import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.transport.MessageFormatter;
 import org.apache.axis2.util.JavaUtils;
-import org.apache.commons.httpclient.methods.RequestEntity;
 
 import javax.xml.stream.FactoryConfigurationError;
 import java.io.IOException;
@@ -35,7 +34,7 @@ import java.util.zip.GZIPOutputStream;
  * This Request Entity is used by the HTTPCommonsTransportSender. This wraps the
  * Axis2 message formatter object.
  */
-public class AxisRequestEntity implements RequestEntity {
+public abstract class AxisRequestEntity  {
 
     private MessageFormatter messageFormatter;
 
@@ -114,7 +113,17 @@ public class AxisRequestEntity implements RequestEntity {
         return bytes.length;
     }
 
-    public String getContentType() {
+    public String getContentTypeAsString() {
         return messageFormatter.getContentType(messageContext, format, soapAction);
     }
+
+    public boolean isChunked() {
+        return chunked;
+    }
+
+    public void setChunked(boolean chunked) {
+        this.chunked = chunked;
+    }
+    
+    
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java b/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
index ae43283..f78af68 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
@@ -555,7 +555,23 @@ public class AxisServlet extends HttpServlet {
         // AXIS2-4898: MultiThreadedHttpConnectionManager starts a thread that is not stopped by the
         // shutdown of the connection manager. If we want to avoid a resource leak, we need to call
         // shutdownAll here.
-        MultiThreadedHttpConnectionManager.shutdownAll();
+        // TODO - This action need be changed according to current HTTPClient.
+        String clientVersion = getHTTPClientVersion();
+        if (clientVersion != null
+                && HTTPTransportConstants.HTTP_CLIENT_4_X_VERSION.equals(clientVersion)) {
+            // TODO - Handle for HTTPClient 4
+        } else {
+            MultiThreadedHttpConnectionManager.shutdownAll();
+        }
+        
+    }
+
+    private String getHTTPClientVersion() {
+        Object version = configContext.getProperty(HTTPTransportConstants.HTTP_CLIENT_VERSION);
+        if (version != null) {
+            return String.valueOf(version);
+        }
+        return null;
     }
 
     /**
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java b/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
index edb7d99..4181a56 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
@@ -31,11 +31,10 @@ import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.axis2.transport.MessageFormatter;
 import org.apache.axis2.transport.OutTransportInfo;
-import org.apache.axis2.transport.TransportSender;
 import org.apache.axis2.transport.TransportUtils;
+import org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl;
 import org.apache.axis2.transport.http.server.AxisHttpResponse;
 import org.apache.axis2.util.JavaUtils;
-import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -51,8 +50,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.zip.GZIPOutputStream;
 
-public class CommonsHTTPTransportSender extends AbstractHandler implements
-        TransportSender {
+public class CommonsHTTPTransportSender extends AbstractHandler implements HTTPTransportSender {
     /**
      * The {@link TransportOutDescription} object received by the call to
      * {@link #init(ConfigurationContext, TransportOutDescription)}.
@@ -80,20 +78,22 @@ public class CommonsHTTPTransportSender extends AbstractHandler implements
     private int connectionTimeout = HTTPConstants.DEFAULT_CONNECTION_TIMEOUT;
 
     public void cleanup(MessageContext msgContext) throws AxisFault {
-        HttpMethod httpMethod = (HttpMethod) msgContext.getProperty(HTTPConstants.HTTP_METHOD);
-
-        if (httpMethod != null) {
-            // TODO : Don't do this if we're not on the right thread! Can we confirm?
-            log.trace("cleanup() releasing connection for " + httpMethod);
-
-            httpMethod.releaseConnection();
-            msgContext.removeProperty(HTTPConstants.HTTP_METHOD); // guard against multiple calls
-        }
+        
+            HttpMethod httpMethod = (HttpMethod) msgContext.getProperty(HTTPConstants.HTTP_METHOD);
+            if (httpMethod != null) {
+                // TODO : Don't do this if we're not on the right thread! Can we confirm?
+                log.trace("cleanup() releasing connection for " + httpMethod);
+
+                httpMethod.releaseConnection();
+                msgContext.removeProperty(HTTPConstants.HTTP_METHOD); // guard against multiple calls
+            }        
     }
 
     public void init(ConfigurationContext confContext,
                      TransportOutDescription transportOut) throws AxisFault {
         this.transportOut = transportOut;
+        //Set HTTP client version
+        setHTTPClientVersion(confContext);
         
         // <parameter name="PROTOCOL">HTTP/1.0</parameter> or
         // <parameter name="PROTOCOL">HTTP/1.1</parameter> is
@@ -376,7 +376,7 @@ public class CommonsHTTPTransportSender extends AbstractHandler implements
             // select the Message Sender depending on the REST status
             AbstractHTTPSender sender;
 
-            sender = new HTTPSender();
+            sender = new HTTPSenderImpl();
 
             boolean chunked;
             if (messageContext.getProperty(HTTPConstants.CHUNKED) != null) {
@@ -403,10 +403,7 @@ public class CommonsHTTPTransportSender extends AbstractHandler implements
         } catch (MalformedURLException e) {
             log.debug(e);
             throw AxisFault.makeFault(e);
-        } catch (HttpException e) {
-            log.debug(e);
-            throw AxisFault.makeFault(e);
-        } catch (IOException e) {
+        }  catch (IOException e) {
             log.debug(e);
             throw AxisFault.makeFault(e);
         }
@@ -505,4 +502,10 @@ public class CommonsHTTPTransportSender extends AbstractHandler implements
 
         return soapActionString;
     }
+    
+    public void setHTTPClientVersion(ConfigurationContext configurationContext) {
+        configurationContext.setProperty(HTTPTransportConstants.HTTP_CLIENT_VERSION,
+                HTTPTransportConstants.HTTP_CLIENT_3_X_VERSION);
+    }
+    
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java b/modules/transport/http/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java
index d09ebad..828d226 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java
@@ -19,30 +19,18 @@
 
 package org.apache.axis2.transport.http;
 
-import org.apache.commons.httpclient.Header;
 
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
-public class CommonsTransportHeaders implements Map {
-    private Header[] headers;
+public abstract class CommonsTransportHeaders implements Map {  
 
     HashMap headerMap = null;
-
-    public CommonsTransportHeaders(Header[] headers) {
-        this.headers = headers;
-    }
-
-    private void init() {
-        headerMap = new HashMap();
-
-        for (int i = 0; i < headers.length; i++) {
-            headerMap.put(headers[i].getName(), headers[i].getValue());
-        }
-    }
-
+   
+    protected abstract void init();
+    
     public int size() {
         if (headerMap == null) {
             init();
@@ -125,4 +113,14 @@ public class CommonsTransportHeaders implements Map {
         }
         return headerMap.put(key, value);
     }
+
+    public HashMap getHeaderMap() {
+        return headerMap;
+    }
+
+    public void setHeaderMap(HashMap headerMap) {
+        this.headerMap = headerMap;
+    }
+    
+    
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/HTTPAuthenticator.java b/modules/transport/http/src/org/apache/axis2/transport/http/HTTPAuthenticator.java
new file mode 100644
index 0000000..2796b5e
--- /dev/null
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/HTTPAuthenticator.java
@@ -0,0 +1,107 @@
+/*
+ * 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 java.util.List;
+
+public abstract class HTTPAuthenticator {
+
+    /* host that needed to be authenticated with */
+    private String host;
+    /* Domain needed by NTCredentials for NT Domain */
+    private String domain;
+    /* User for authenticate */
+    private String username;
+    /* Password of the user for authenticate */
+    private String password;
+    /* Switch to use preemptive authentication or not */
+    private boolean preemptive = false;
+    /* if Authentication scheme needs retry just turn on the following flag */
+    private boolean allowedRetry = false;
+    /* Changing the priorty or adding a custom AuthPolicy */
+    private List authSchemes;
+
+    public abstract int getPort();
+
+    public abstract void setPort(int port);
+
+    public abstract String getRealm();
+
+    public abstract void setRealm(String realm);
+
+    public abstract Object getAuthPolicyPref(String schema);
+
+    public String getHost() {
+        return host;
+    }
+
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public void setPreemptiveAuthentication(boolean preemptive) {
+        this.preemptive = preemptive;
+    }
+
+    public boolean getPreemptiveAuthentication() {
+        return this.preemptive;
+    }
+
+    public String getDomain() {
+        return domain;
+    }
+
+    public void setDomain(String domain) {
+        this.domain = domain;
+    }
+
+    public void setAuthSchemes(List authSchemes) {
+        this.authSchemes = authSchemes;
+    }
+
+    public List getAuthSchemes() {
+        return this.authSchemes;
+    }
+
+    public void setAllowedRetry(boolean allowedRetry) {
+        this.allowedRetry = allowedRetry;
+    }
+
+    public boolean isAllowedRetry() {
+        return this.allowedRetry;
+    }
+
+}
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java b/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java
index 1227004..118ffbf 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java
@@ -23,58 +23,17 @@ package org.apache.axis2.transport.http;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.transport.MessageFormatter;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.methods.DeleteMethod;
-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.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import java.io.IOException;
 import java.net.URL;
 
-public class HTTPSender extends AbstractHTTPSender {
+//TODO - It better if we can define these method in a interface move these into AbstractHTTPSender and get rid of this class.
+public abstract class HTTPSender extends AbstractHTTPSender {
 
     private static final Log log = LogFactory.getLog(HTTPSender.class);
-
-    public void send(MessageContext msgContext, URL url, String soapActionString)
-            throws IOException {
-
-        // execute the HtttpMethodBase - a connection manager can be given for
-        // handle multiple
-
-        String httpMethod =
-                (String) msgContext.getProperty(Constants.Configuration.HTTP_METHOD);
-
-        if ((httpMethod != null)) {
-
-            if (Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod)) {
-                this.sendViaGet(msgContext, url, soapActionString);
-
-                return;
-            } else if (Constants.Configuration.HTTP_METHOD_DELETE.equalsIgnoreCase(httpMethod)) {
-                this.sendViaDelete(msgContext, url, soapActionString);
-
-                return;
-            } else if (Constants.Configuration.HTTP_METHOD_PUT.equalsIgnoreCase(httpMethod)) {
-                this.sendViaPut(msgContext, url, soapActionString);
-
-                return;
-            }
-        }
-
-        this.sendViaPost(msgContext, url, soapActionString);
-    }
-
+    
     /**
      * Used to send a request via HTTP Get method
      *
@@ -83,39 +42,9 @@ public class HTTPSender extends AbstractHTTPSender {
      * @param soapActiionString - The soapAction string of the request
      * @throws AxisFault - Thrown in case an exception occurs
      */
-    private void sendViaGet(MessageContext msgContext, URL url, String soapActiionString)
-            throws AxisFault {
-
-        GetMethod getMethod = new GetMethod();
-        HttpClient httpClient = getHttpClient(msgContext);
-        MessageFormatter messageFormatter =
-                populateCommonProperties(msgContext, url, getMethod, httpClient, soapActiionString);
-
-        // Need to have this here because we can have soap action when using the soap response MEP
-        String soapAction =
-                messageFormatter.formatSOAPAction(msgContext, format, soapActiionString);
-
-        if (soapAction != null) {
-            getMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
-        }
-        try {
-            executeMethod(httpClient, msgContext, url, getMethod);
-            handleResponse(msgContext, getMethod);
-        } catch (IOException e) {
-            log.info("Unable to sendViaGet to url[" + url + "]", e);
-            throw AxisFault.makeFault(e);
-        } finally {
-            cleanup(msgContext, getMethod);
-        }
-    }
-
-    private void cleanup(MessageContext msgContext, HttpMethod method) {
-        if (msgContext.isPropertyTrue(HTTPConstants.AUTO_RELEASE_CONNECTION)) {
-            log.trace("AutoReleasing " + method);
-            method.releaseConnection();
-        }
-    }
-
+    protected abstract void sendViaGet(MessageContext msgContext, URL url, String soapActiionString)
+            throws AxisFault;
+    
     /**
      * Used to send a request via HTTP Delete Method
      *
@@ -124,24 +53,8 @@ public class HTTPSender extends AbstractHTTPSender {
      * @param soapActiionString - The soapAction string of the request
      * @throws AxisFault - Thrown in case an exception occurs
      */
-    private void sendViaDelete(MessageContext msgContext, URL url, String soapActiionString)
-            throws AxisFault {
-
-        DeleteMethod deleteMethod = new DeleteMethod();
-        HttpClient httpClient = getHttpClient(msgContext);
-        populateCommonProperties(msgContext, url, deleteMethod, httpClient, soapActiionString);
-
-        try {
-            executeMethod(httpClient, msgContext, url, deleteMethod);
-            handleResponse(msgContext, deleteMethod);
-        } catch (IOException e) {
-            log.info("Unable to sendViaDelete to url[" + url + "]", e);
-            throw AxisFault.makeFault(e);
-        } finally {
-            cleanup(msgContext, deleteMethod);
-        }
-    }
-
+    protected abstract void sendViaDelete(MessageContext msgContext, URL url, String soapActiionString)
+            throws AxisFault; 
     /**
      * Used to send a request via HTTP Post Method
      *
@@ -150,55 +63,9 @@ public class HTTPSender extends AbstractHTTPSender {
      * @param soapActionString - The soapAction string of the request
      * @throws AxisFault - Thrown in case an exception occurs
      */
-    private void sendViaPost(MessageContext msgContext, URL url,
-                             String soapActionString) throws AxisFault {
-
-
-        HttpClient httpClient = getHttpClient(msgContext);
-
-/*  What's up with this, it never gets used anywhere?? --Glen
-        String charEncoding =
-                (String) msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
-
-        if (charEncoding == null) {
-            charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
-        }
-*/
-
-        PostMethod postMethod = new PostMethod();
-        if (log.isTraceEnabled()) {
-            log.trace(Thread.currentThread() + " PostMethod " + postMethod + " / " + httpClient);
-        }
-        MessageFormatter messageFormatter =
-                populateCommonProperties(msgContext, url, postMethod, httpClient, soapActionString);
+    protected abstract void sendViaPost(MessageContext msgContext, URL url,
+                             String soapActionString) throws AxisFault;
 
-        postMethod.setRequestEntity(new AxisRequestEntity(messageFormatter,
-                                                          msgContext, format, soapActionString,
-                                                          chunked, isAllowedRetry));
-
-        if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) {
-            postMethod.setContentChunked(true);
-        }
-
-        String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString);
-
-        if (soapAction != null) {
-            postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
-        }
-
-        /*
-         *   main excecution takes place..
-         */
-        try {
-            executeMethod(httpClient, msgContext, url, postMethod);
-            handleResponse(msgContext, postMethod);
-        } catch (IOException e) {
-            log.info("Unable to sendViaPost to url[" + url + "]", e);
-            throw AxisFault.makeFault(e);
-        } finally {
-            cleanup(msgContext, postMethod);
-        }
-    }
 
     /**
      * Used to send a request via HTTP Put Method
@@ -208,51 +75,10 @@ public class HTTPSender extends AbstractHTTPSender {
      * @param soapActionString - The soapAction string of the request
      * @throws AxisFault - Thrown in case an exception occurs
      */
-    private void sendViaPut(MessageContext msgContext, URL url,
-                            String soapActionString) throws AxisFault {
-
-
-        HttpClient httpClient = getHttpClient(msgContext);
-
-/*  Same deal - this value never gets used, why is it here? --Glen
-        String charEncoding =
-                (String) msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
-
-        if (charEncoding == null) {
-            charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
-        }
-*/
+    protected abstract void sendViaPut(MessageContext msgContext, URL url,
+                            String soapActionString) throws AxisFault;
 
-        PutMethod putMethod = new PutMethod();
-        MessageFormatter messageFormatter =
-                populateCommonProperties(msgContext, url, putMethod, httpClient, soapActionString);
-
-        putMethod.setRequestEntity(new AxisRequestEntity(messageFormatter,
-                                                         msgContext, format, soapActionString,
-                                                         chunked, isAllowedRetry));
-
-        if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) {
-            putMethod.setContentChunked(true);
-        }
-
-        String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString);
-        if (soapAction != null) {
-            putMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
-        }
-
-        /*
-         *   main excecution takes place..
-         */
-        try {
-            executeMethod(httpClient, msgContext, url, putMethod);
-            handleResponse(msgContext, putMethod);
-        } catch (IOException e) {
-            log.info("Unable to sendViaPut to url[" + url + "]", e);
-            throw AxisFault.makeFault(e);
-        } finally {
-            cleanup(msgContext, putMethod);
-        }
-    }
+     
 
     /**
      * Used to handle the HTTP Response
@@ -261,55 +87,40 @@ public class HTTPSender extends AbstractHTTPSender {
      * @param method     - The HTTP method used
      * @throws IOException - Thrown in case an exception occurs
      */
-    private void handleResponse(MessageContext msgContext,
-                                HttpMethodBase method) throws IOException {
-        int statusCode = method.getStatusCode();
-        log.trace("Handling response - " + statusCode);
-        if (statusCode == HttpStatus.SC_OK) {
-            // Save the HttpMethod so that we can release the connection when cleaning up
-            msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
-            processResponse(method, msgContext);
-        } else if (statusCode == HttpStatus.SC_ACCEPTED) {
-        	/* When an HTTP 202 Accepted code has been received, this will be the case of an execution 
-        	 * of an in-only operation. In such a scenario, the HTTP response headers should be returned,
-        	 * i.e. session cookies. */
-        	obtainHTTPHeaderInformation(method, msgContext);
-        	// Since we don't expect any content with a 202 response, we must release the connection
-        	method.releaseConnection();
-        } else if (statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR ||
-                statusCode == HttpStatus.SC_BAD_REQUEST) {
-            // Save the HttpMethod so that we can release the connection when cleaning up
-            msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
-            Header contenttypeHeader =
-                    method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
-            String value = null;
-            if (contenttypeHeader != null) {
-                value = contenttypeHeader.getValue();
-            }
-             OperationContext opContext = msgContext.getOperationContext();
-            if(opContext!=null){
-                MessageContext inMessageContext =
-                        opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-                if(inMessageContext!=null){
-                    inMessageContext.setProcessingFault(true);
-                }
-            }
-            if (value != null) {
+    protected abstract void handleResponse(MessageContext msgContext,
+                                Object httpMethodBase) throws IOException;
+    
+    protected abstract void cleanup(MessageContext msgContext, Object httpMethod);
+    
+    
 
-                processResponse(method, msgContext);
-            }
-            
-            if (org.apache.axis2.util.Utils.isClientThreadNonBlockingPropertySet(msgContext)) {
-            	 throw new AxisFault(Messages.getMessage("transportError",
-                         String.valueOf(statusCode),
-                         method.getStatusText()));
+    public void send(MessageContext msgContext, URL url, String soapActionString)
+            throws IOException {
+
+        // execute the HtttpMethodBase - a connection manager can be given for
+        // handle multiple
+
+        String httpMethod =
+                (String) msgContext.getProperty(Constants.Configuration.HTTP_METHOD);
+
+        if ((httpMethod != null)) {
+
+            if (Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod)) {
+                this.sendViaGet(msgContext, url, soapActionString);
+
+                return;
+            } else if (Constants.Configuration.HTTP_METHOD_DELETE.equalsIgnoreCase(httpMethod)) {
+                this.sendViaDelete(msgContext, url, soapActionString);
+
+                return;
+            } else if (Constants.Configuration.HTTP_METHOD_PUT.equalsIgnoreCase(httpMethod)) {
+                this.sendViaPut(msgContext, url, soapActionString);
+
+                return;
             }
-        } else {
-            // Since we don't process the response, we must release the connection immediately
-            method.releaseConnection();
-            throw new AxisFault(Messages.getMessage("transportError",
-                                                    String.valueOf(statusCode),
-                                                    method.getStatusText()));
         }
-    }
+
+        this.sendViaPost(msgContext, url, soapActionString);
+    }    
+       
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/HTTPTransportConstants.java b/modules/transport/http/src/org/apache/axis2/transport/http/HTTPTransportConstants.java
new file mode 100644
index 0000000..73dfeb5
--- /dev/null
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/HTTPTransportConstants.java
@@ -0,0 +1,52 @@
+/*
+ * 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;
+
+public class HTTPTransportConstants {
+
+    //Settings for HTTP proxy configuration.
+    public static final String HTTP_PROXY_HOST = "http.proxyHost";
+    public static final String HTTP_PROXY_PORT = "http.proxyPort";
+    public static final String HTTP_NON_PROXY_HOSTS = "http.nonProxyHosts";
+
+    public static final String ATTR_PROXY = "Proxy";
+    public static final String PROXY_HOST_ELEMENT = "ProxyHost";
+    public static final String PROXY_PORT_ELEMENT = "ProxyPort";
+    public static final String PROXY_USER_ELEMENT = "ProxyUser";
+    public static final String PROXY_PASSWORD_ELEMENT = "ProxyPassword";
+
+    public static final String PROXY_CONFIGURATION_NOT_FOUND = "HTTP Proxy is enabled, but proxy configuration element is missing in axis2.xml";
+    public static final String PROXY_HOST_ELEMENT_NOT_FOUND = "HTTP Proxy is enabled, but proxy host element is missing in axis2.xml";
+    public static final String PROXY_PORT_ELEMENT_NOT_FOUND = "HTTP Proxy is enabled, but proxy port element is missing in axis2.xml";
+    public static final String PROXY_HOST_ELEMENT_WITH_EMPTY_VALUE = "HTTP Proxy is enabled, but proxy host value is empty.";
+    public static final String PROXY_PORT_ELEMENT_WITH_EMPTY_VALUE = "HTTP Proxy is enabled, but proxy port value is empty.";
+    
+    //Settings to define HTTPClient version
+    public static final String HTTP_CLIENT_VERSION = "http.client.version"; 
+    public static final String HTTP_CLIENT_3_X_VERSION = "http.client.version.3x";
+    public static final String HTTP_CLIENT_4_X_VERSION = "http.client.version.4x";  
+    
+    public static final String ANONYMOUS = "anonymous";
+    public static final String PROXY_HOST_NAME = "proxy_host";
+    public static final String PROXY_PORT = "proxy_port";
+    public static final String PROTOCOL_HTTP = "http";
+    public static final String PROTOCOL_HTTPS = "https";
+
+}
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java b/modules/transport/http/src/org/apache/axis2/transport/http/HTTPTransportSender.java
similarity index 52%
copy from modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
copy to modules/transport/http/src/org/apache/axis2/transport/http/HTTPTransportSender.java
index 81a3c6e..0f6641e 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/HTTPTransportSender.java
@@ -19,33 +19,11 @@
 
 package org.apache.axis2.transport.http;
 
-import org.apache.commons.httpclient.methods.RequestEntity;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.transport.TransportSender;
 
-import java.io.IOException;
-import java.io.OutputStream;
+public interface HTTPTransportSender extends TransportSender {
 
-public class RESTRequestEntity2 implements RequestEntity {
-    private String contentType;
-    private String postRequestBody;
+    void setHTTPClientVersion(ConfigurationContext configurationContext);
 
-    public RESTRequestEntity2(String postRequestBody, String contentType) {
-        this.postRequestBody = postRequestBody;
-        this.contentType = contentType;
-    }
-
-    public void writeRequest(OutputStream output) throws IOException {
-        output.write(postRequestBody.getBytes());
-    }
-
-    public long getContentLength() {
-        return this.postRequestBody.getBytes().length;
-    }
-
-    public String getContentType() {
-        return this.contentType;
-    }
-
-    public boolean isRepeatable() {
-        return true;
-    }
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/HttpTransportProperties.java b/modules/transport/http/src/org/apache/axis2/transport/http/HttpTransportProperties.java
index 25c58bf..01f7376 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/HttpTransportProperties.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/HttpTransportProperties.java
@@ -19,48 +19,36 @@
 
 package org.apache.axis2.transport.http;
 
-import org.apache.commons.httpclient.HttpVersion;
-import org.apache.commons.httpclient.auth.AuthPolicy;
-import org.apache.commons.httpclient.auth.AuthScope;
-
-import java.util.List;
 import java.util.Properties;
 
 /**
  * Utility bean for setting transport properties in runtime.
  */
-public class HttpTransportProperties {
-    protected boolean chunked;
-    protected HttpVersion httpVersion;
+public abstract class HttpTransportProperties {
+    
+    protected boolean chunked;    
     protected String protocol;
-
-    public HttpTransportProperties() {
-    }
+       
+    public abstract void setHttpVersion(Object httpVerion);
+    
+    public abstract Object getHttpVersion();
 
     public boolean getChunked() {
         return chunked;
     }
-
-    public HttpVersion getHttpVersion() {
-        return httpVersion;
-    }
-
+    
     public String getProtocol() {
         return protocol;
     }
 
     public void setChunked(boolean chunked) {
         this.chunked = chunked;
-    }
-
-    public void setHttpVersion(HttpVersion httpVerion) {
-        this.httpVersion = httpVerion;
-    }
+    }  
 
     public void setProtocol(String protocol) {
         this.protocol = protocol;
     }
-
+    
     public static class ProxyProperties {
         protected int proxyPort = -1;
         protected String domain = null;
@@ -112,109 +100,7 @@ public class HttpTransportProperties {
         }
     }
 
-    /*
-    This class is responsible for holding all the necessary information needed for NTML, Digest
-    and Basic Authentication. Authentication itself is handled by httpclient. User doesn't need to
-    warry about what authentication mechanism it uses. Axis2 uses httpclinet's default authentication
-    patterns.
-    */
-    public static class Authenticator {
-        /*host that needed to be authenticated with*/
-        private String host;
-        /*port of the host that needed to be authenticated with*/
-        private int port = AuthScope.ANY_PORT;
-        /*Realm for authentication scope*/
-        private String realm = AuthScope.ANY_REALM;
-        /*Domain needed by NTCredentials for NT Domain*/
-        private String domain;
-        /*User for authenticate*/
-        private String username;
-        /*Password of the user for authenticate*/
-        private String password;
-        /* Switch to use preemptive authentication or not*/
-        private boolean preemptive = false;
-        /* if Authentication scheme needs retry just turn on the following flag */
-        private boolean allowedRetry = false;
-        /* Changing the priorty or adding a custom AuthPolicy*/
-        private List authSchemes;
-
-        /* Default Auth Schems*/
-        public static final String NTLM = AuthPolicy.NTLM;
-        public static final String DIGEST = AuthPolicy.DIGEST;
-        public static final String BASIC = AuthPolicy.BASIC;
-
-        public String getHost() {
-            return host;
-        }
-
-        public void setHost(String host) {
-            this.host = host;
-        }
-
-        public int getPort() {
-            return port;
-        }
-
-        public void setPort(int port) {
-            this.port = port;
-        }
-
-        public String getRealm() {
-            return realm;
-        }
-
-        public void setRealm(String realm) {
-            this.realm = realm;
-        }
-
-        public String getUsername() {
-            return username;
-        }
-
-        public void setUsername(String username) {
-            this.username = username;
-        }
-
-        public String getPassword() {
-            return password;
-        }
-
-        public void setPassword(String password) {
-            this.password = password;
-        }
-
-        public void setPreemptiveAuthentication(boolean preemptive) {
-            this.preemptive = preemptive;
-        }
-
-        public boolean getPreemptiveAuthentication() {
-            return this.preemptive;
-        }
-
-        public String getDomain() {
-            return domain;
-        }
-
-        public void setDomain(String domain) {
-            this.domain = domain;
-        }
-
-        public void setAuthSchemes(List authSchemes) {
-            this.authSchemes = authSchemes;
-        }
-
-        public List getAuthSchemes() {
-            return this.authSchemes;
-        }
-
-        public void setAllowedRetry(boolean allowedRetry) {
-            this.allowedRetry = allowedRetry;
-        }
-
-        public boolean isAllowedRetry() {
-            return this.allowedRetry;
-        }
-    }
+   
 
     /**
      * @deprecated org.apache.axis2.transport.http.HttpTransportProperties.MailProperties has been
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity.java b/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity.java
index bca0588..6410584 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity.java
@@ -23,7 +23,6 @@ import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
-import org.apache.commons.httpclient.methods.RequestEntity;
 
 import javax.xml.stream.FactoryConfigurationError;
 import javax.xml.stream.XMLStreamException;
@@ -31,7 +30,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 
-public class RESTRequestEntity implements RequestEntity {
+public abstract class RESTRequestEntity {
     private byte[] bytes;
     private String charSetEnc;
     private boolean chunked;
@@ -115,7 +114,7 @@ public class RESTRequestEntity implements RequestEntity {
         }
     }
 
-    public String getContentType() {
+    public String getContentTypeAsString() {
         String encoding = format.getCharSetEncoding();
         String contentType = format.getContentType();
         if (encoding != null) {
@@ -133,4 +132,61 @@ public class RESTRequestEntity implements RequestEntity {
     public boolean isRepeatable() {
         return true;
     }
+
+    public byte[] getBytes() {
+        return bytes;
+    }
+
+    public void setBytes(byte[] bytes) {
+        this.bytes = bytes;
+    }
+
+    public String getCharSetEnc() {
+        return charSetEnc;
+    }
+
+    public void setCharSetEnc(String charSetEnc) {
+        this.charSetEnc = charSetEnc;
+    }
+
+    public boolean isChunked() {
+        return chunked;
+    }
+
+    public void setChunked(boolean chunked) {
+        this.chunked = chunked;
+    }
+
+    public OMElement getElement() {
+        return element;
+    }
+
+    public void setElement(OMElement element) {
+        this.element = element;
+    }
+
+    public MessageContext getMsgCtxt() {
+        return msgCtxt;
+    }
+
+    public void setMsgCtxt(MessageContext msgCtxt) {
+        this.msgCtxt = msgCtxt;
+    }
+
+    public String getSoapActionString() {
+        return soapActionString;
+    }
+
+    public void setSoapActionString(String soapActionString) {
+        this.soapActionString = soapActionString;
+    }
+
+    public OMOutputFormat getFormat() {
+        return format;
+    }
+
+    public void setFormat(OMOutputFormat format) {
+        this.format = format;
+    }    
+    
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java b/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
index 81a3c6e..434b127 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
@@ -19,12 +19,10 @@
 
 package org.apache.axis2.transport.http;
 
-import org.apache.commons.httpclient.methods.RequestEntity;
-
 import java.io.IOException;
 import java.io.OutputStream;
 
-public class RESTRequestEntity2 implements RequestEntity {
+public abstract class RESTRequestEntity2 {
     private String contentType;
     private String postRequestBody;
 
@@ -41,11 +39,25 @@ public class RESTRequestEntity2 implements RequestEntity {
         return this.postRequestBody.getBytes().length;
     }
 
-    public String getContentType() {
+    public String getContentTypeAsString() {
         return this.contentType;
     }
 
     public boolean isRepeatable() {
         return true;
     }
+   
+
+    public void setContentType(String contentType) {
+        this.contentType = contentType;
+    }
+
+    public String getPostRequestBody() {
+        return postRequestBody;
+    }
+
+    public void setPostRequestBody(String postRequestBody) {
+        this.postRequestBody = postRequestBody;
+    }
+    
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/AxisRequestEntityImpl.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/AxisRequestEntityImpl.java
new file mode 100644
index 0000000..33f42e9
--- /dev/null
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/AxisRequestEntityImpl.java
@@ -0,0 +1,50 @@
+/*
+ * 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.httpclient3;
+
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.transport.http.AxisRequestEntity;
+
+import org.apache.commons.httpclient.methods.RequestEntity;
+
+/**
+ * This Request Entity is used by the HTTPCommonsTransportSender. This wraps the
+ * Axis2 message formatter object.
+ */
+public class AxisRequestEntityImpl extends AxisRequestEntity implements RequestEntity {
+
+    /**
+     * Method calls to this request entity are delegated to the following Axis2
+     * message formatter object.
+     * 
+     * @param messageFormatter
+     */
+    public AxisRequestEntityImpl(MessageFormatter messageFormatter, MessageContext msgContext,
+            OMOutputFormat format, String soapAction, boolean chunked, boolean isAllowedRetry) {
+        super(messageFormatter, msgContext, format, soapAction, chunked, isAllowedRetry);
+    }
+
+    public String getContentType() {
+        return getContentTypeAsString();
+    }
+
+}
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPClient3TransportSender.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPClient3TransportSender.java
new file mode 100644
index 0000000..fbaaef4
--- /dev/null
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPClient3TransportSender.java
@@ -0,0 +1,42 @@
+/*
+ * 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.httpclient3;
+
+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.HTTPTransportConstants;
+import org.apache.axis2.transport.http.HTTPTransportSender;
+
+public class HTTPClient3TransportSender extends CommonsHTTPTransportSender implements
+        HTTPTransportSender {
+
+    public void setHTTPClientVersion(ConfigurationContext configurationContext) {
+        configurationContext.setProperty(HTTPTransportConstants.HTTP_CLIENT_VERSION,
+                HTTPTransportConstants.HTTP_CLIENT_3_X_VERSION);
+    }
+
+    @Override
+    public void cleanup(MessageContext msgContext) throws AxisFault {
+        super.cleanup(msgContext);
+    }
+
+}
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/util/HTTPProxyConfigurationUtil.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPProxcyConfigurator.java
similarity index 60%
copy from modules/transport/http/src/org/apache/axis2/transport/http/util/HTTPProxyConfigurationUtil.java
copy to modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPProxcyConfigurator.java
index a163450..670e9e1 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/util/HTTPProxyConfigurationUtil.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPProxcyConfigurator.java
@@ -17,13 +17,19 @@
  * under the License.
  */
 
-package org.apache.axis2.transport.http.util;
+package org.apache.axis2.transport.http.impl.httpclient3;
+
+import java.net.URL;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.HTTPTransportConstants;
 import org.apache.axis2.transport.http.HttpTransportProperties;
 import org.apache.commons.httpclient.Credentials;
 import org.apache.commons.httpclient.HostConfiguration;
@@ -35,60 +41,31 @@ import org.apache.commons.httpclient.auth.AuthScope;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.namespace.QName;
-import java.net.URL;
-import java.util.StringTokenizer;
+public class HTTPProxcyConfigurator {
 
-/**
- * Contains utility functions used when configuring HTTP Proxy for HTTP Sender.
- */
-public class HTTPProxyConfigurationUtil {
-    private static Log log = LogFactory.getLog(HTTPProxyConfigurationUtil.class);
-
-    protected static final String HTTP_PROXY_HOST = "http.proxyHost";
-    protected static final String HTTP_PROXY_PORT = "http.proxyPort";
-    protected static final String HTTP_NON_PROXY_HOSTS = "http.nonProxyHosts";
-
-    protected static final String ATTR_PROXY = "Proxy";
-    protected static final String PROXY_HOST_ELEMENT = "ProxyHost";
-    protected static final String PROXY_PORT_ELEMENT = "ProxyPort";
-    protected static final String PROXY_USER_ELEMENT = "ProxyUser";
-    protected static final String PROXY_PASSWORD_ELEMENT = "ProxyPassword";
-
-
-    protected static final String PROXY_CONFIGURATION_NOT_FOUND =
-            "HTTP Proxy is enabled, but proxy configuration element is missing in axis2.xml";
-    protected static final String PROXY_HOST_ELEMENT_NOT_FOUND =
-            "HTTP Proxy is enabled, but proxy host element is missing in axis2.xml";
-    protected static final String PROXY_PORT_ELEMENT_NOT_FOUND =
-            "HTTP Proxy is enabled, but proxy port element is missing in axis2.xml";
-    protected static final String PROXY_HOST_ELEMENT_WITH_EMPTY_VALUE =
-            "HTTP Proxy is enabled, but proxy host value is empty.";
-    protected static final String PROXY_PORT_ELEMENT_WITH_EMPTY_VALUE =
-            "HTTP Proxy is enabled, but proxy port value is empty.";
+    private static Log log = LogFactory.getLog(HTTPProxcyConfigurator.class);
 
     /**
-     * Configure HTTP Proxy settings of commons-httpclient HostConfiguration. Proxy settings can be get from
-     * axis2.xml, Java proxy settings or can be override through property in message context.
+     * Configure HTTP Proxy settings of commons-httpclient HostConfiguration.
+     * Proxy settings can be get from axis2.xml, Java proxy settings or can be
+     * override through property in message context.
      * <p/>
-     * HTTP Proxy setting element format:
-     * <parameter name="Proxy">
-     * <Configuration>
-     * <ProxyHost>example.org</ProxyHost>
-     * <ProxyPort>3128</ProxyPort>
-     * <ProxyUser>EXAMPLE/John</ProxyUser>
-     * <ProxyPassword>password</ProxyPassword>
-     * <Configuration>
-     * <parameter>
-     *
-     * @param messageContext in message context for
-     * @param httpClient     commons-httpclient instance
-     * @param config         commons-httpclient HostConfiguration
-     * @throws AxisFault if Proxy settings are invalid
+     * HTTP Proxy setting element format: <parameter name="Proxy">
+     * <Configuration> <ProxyHost>example.org</ProxyHost>
+     * <ProxyPort>3128</ProxyPort> <ProxyUser>EXAMPLE/John</ProxyUser>
+     * <ProxyPassword>password</ProxyPassword> <Configuration> <parameter>
+     * 
+     * @param messageContext
+     *            in message context for
+     * @param httpClient
+     *            commons-httpclient instance
+     * @param config
+     *            commons-httpclient HostConfiguration
+     * @throws AxisFault
+     *             if Proxy settings are invalid
      */
-    public static void configure(MessageContext messageContext,
-                                 HttpClient httpClient,
-                                 HostConfiguration config) throws AxisFault {
+    public static void configure(MessageContext messageContext, HttpClient httpClient,
+            HostConfiguration config) throws AxisFault {
 
         Credentials proxyCredentials = null;
         String proxyHost = null;
@@ -97,23 +74,23 @@ public class HTTPProxyConfigurationUtil {
         String proxyUser = null;
         String proxyPassword = null;
 
-        //Getting configuration values from Axis2.xml
-        Parameter proxySettingsFromAxisConfig = messageContext.getConfigurationContext().getAxisConfiguration()
-                .getParameter(ATTR_PROXY);
+        // Getting configuration values from Axis2.xml
+        Parameter proxySettingsFromAxisConfig = messageContext.getConfigurationContext()
+                .getAxisConfiguration().getParameter(HTTPTransportConstants.ATTR_PROXY);
         if (proxySettingsFromAxisConfig != null) {
             OMElement proxyConfiguration = getProxyConfigurationElement(proxySettingsFromAxisConfig);
             proxyHost = getProxyHost(proxyConfiguration);
             proxyPort = getProxyPort(proxyConfiguration);
             proxyUser = getProxyUser(proxyConfiguration);
             proxyPassword = getProxyPassword(proxyConfiguration);
-            if(proxyUser != null){
-                if(proxyPassword == null){
+            if (proxyUser != null) {
+                if (proxyPassword == null) {
                     proxyPassword = "";
                 }
                 int proxyUserDomainIndex = proxyUser.indexOf("\\");
-                if( proxyUserDomainIndex > 0){
+                if (proxyUserDomainIndex > 0) {
                     String domain = proxyUser.substring(0, proxyUserDomainIndex);
-                    if(proxyUser.length() > proxyUserDomainIndex + 1) {
+                    if (proxyUser.length() > proxyUserDomainIndex + 1) {
                         String user = proxyUser.substring(proxyUserDomainIndex + 1);
                         proxyCredentials = new NTCredentials(user, proxyPassword, proxyHost, domain);
                     }
@@ -123,12 +100,13 @@ public class HTTPProxyConfigurationUtil {
 
         }
 
-        // If there is runtime proxy settings, these settings will override settings from axis2.xml
-        HttpTransportProperties.ProxyProperties proxyProperties =
-                (HttpTransportProperties.ProxyProperties) messageContext.getProperty(HTTPConstants.PROXY);
-        if(proxyProperties != null) {
+        // If there is runtime proxy settings, these settings will override
+        // settings from axis2.xml
+        HttpTransportProperties.ProxyProperties proxyProperties = (HttpTransportProperties.ProxyProperties) messageContext
+                .getProperty(HTTPConstants.PROXY);
+        if (proxyProperties != null) {
             String proxyHostProp = proxyProperties.getProxyHostName();
-            if(proxyHostProp == null || proxyHostProp.length() <= 0) {
+            if (proxyHostProp == null || proxyHostProp.length() <= 0) {
                 throw new AxisFault("HTTP Proxy host is not available. Host is a MUST parameter");
             } else {
                 proxyHost = proxyHostProp;
@@ -140,29 +118,30 @@ public class HTTPProxyConfigurationUtil {
             String password = proxyProperties.getPassWord();
             String domain = proxyProperties.getDomain();
 
-            if(userName != null && password != null && domain != null){
+            if (userName != null && password != null && domain != null) {
                 proxyCredentials = new NTCredentials(userName, password, proxyHost, domain);
-            } else if(userName != null && domain == null){
+            } else if (userName != null && domain == null) {
                 proxyCredentials = new UsernamePasswordCredentials(userName, password);
             }
 
         }
 
         // Overriding proxy settings if proxy is available from JVM settings
-        String host = System.getProperty(HTTP_PROXY_HOST);
-        if(host != null) {
+        String host = System.getProperty(HTTPTransportConstants.HTTP_PROXY_HOST);
+        if (host != null) {
             proxyHost = host;
         }
 
-        String port = System.getProperty(HTTP_PROXY_PORT);
-        if(port != null) {
+        String port = System.getProperty(HTTPTransportConstants.HTTP_PROXY_PORT);
+        if (port != null) {
             proxyPort = Integer.parseInt(port);
         }
 
-        if(proxyCredentials != null) {
+        if (proxyCredentials != null) {
             httpClient.getParams().setAuthenticationPreemptive(true);
-            HttpState cachedHttpState = (HttpState)messageContext.getProperty(HTTPConstants.CACHED_HTTP_STATE);
-            if(cachedHttpState != null){
+            HttpState cachedHttpState = (HttpState) messageContext
+                    .getProperty(HTTPConstants.CACHED_HTTP_STATE);
+            if (cachedHttpState != null) {
                 httpClient.setState(cachedHttpState);
             }
             httpClient.getState().setProxyCredentials(AuthScope.ANY, proxyCredentials);
@@ -170,45 +149,50 @@ public class HTTPProxyConfigurationUtil {
         config.setProxy(proxyHost, proxyPort);
     }
 
-    private static OMElement getProxyConfigurationElement(Parameter proxySettingsFromAxisConfig) throws AxisFault {
-        OMElement proxyConfigurationElement = proxySettingsFromAxisConfig.getParameterElement().getFirstElement();
+    private static OMElement getProxyConfigurationElement(Parameter proxySettingsFromAxisConfig)
+            throws AxisFault {
+        OMElement proxyConfigurationElement = proxySettingsFromAxisConfig.getParameterElement()
+                .getFirstElement();
         if (proxyConfigurationElement == null) {
-            log.error(PROXY_CONFIGURATION_NOT_FOUND);
-            throw new AxisFault(PROXY_CONFIGURATION_NOT_FOUND);
+            log.error(HTTPTransportConstants.PROXY_CONFIGURATION_NOT_FOUND);
+            throw new AxisFault(HTTPTransportConstants.PROXY_CONFIGURATION_NOT_FOUND);
         }
         return proxyConfigurationElement;
     }
 
     private static String getProxyHost(OMElement proxyConfiguration) throws AxisFault {
-        OMElement proxyHostElement = proxyConfiguration.getFirstChildWithName(new QName(PROXY_HOST_ELEMENT));
+        OMElement proxyHostElement = proxyConfiguration.getFirstChildWithName(new QName(
+                HTTPTransportConstants.PROXY_HOST_ELEMENT));
         if (proxyHostElement == null) {
-            log.error(PROXY_HOST_ELEMENT_NOT_FOUND);
-            throw new AxisFault(PROXY_HOST_ELEMENT_NOT_FOUND);
+            log.error(HTTPTransportConstants.PROXY_HOST_ELEMENT_NOT_FOUND);
+            throw new AxisFault(HTTPTransportConstants.PROXY_HOST_ELEMENT_NOT_FOUND);
         }
         String proxyHost = proxyHostElement.getText();
         if (proxyHost == null) {
-            log.error(PROXY_HOST_ELEMENT_WITH_EMPTY_VALUE);
-            throw new AxisFault(PROXY_HOST_ELEMENT_WITH_EMPTY_VALUE);
+            log.error(HTTPTransportConstants.PROXY_HOST_ELEMENT_WITH_EMPTY_VALUE);
+            throw new AxisFault(HTTPTransportConstants.PROXY_HOST_ELEMENT_WITH_EMPTY_VALUE);
         }
         return proxyHost;
     }
 
     private static Integer getProxyPort(OMElement proxyConfiguration) throws AxisFault {
-        OMElement proxyPortElement = proxyConfiguration.getFirstChildWithName(new QName(PROXY_PORT_ELEMENT));
+        OMElement proxyPortElement = proxyConfiguration.getFirstChildWithName(new QName(
+                HTTPTransportConstants.PROXY_PORT_ELEMENT));
         if (proxyPortElement == null) {
-            log.error(PROXY_PORT_ELEMENT_NOT_FOUND);
-            throw new AxisFault(PROXY_PORT_ELEMENT_NOT_FOUND);
+            log.error(HTTPTransportConstants.PROXY_PORT_ELEMENT_NOT_FOUND);
+            throw new AxisFault(HTTPTransportConstants.PROXY_PORT_ELEMENT_NOT_FOUND);
         }
         String proxyPort = proxyPortElement.getText();
         if (proxyPort == null) {
-            log.error(PROXY_PORT_ELEMENT_WITH_EMPTY_VALUE);
-            throw new AxisFault(PROXY_PORT_ELEMENT_WITH_EMPTY_VALUE);
+            log.error(HTTPTransportConstants.PROXY_PORT_ELEMENT_WITH_EMPTY_VALUE);
+            throw new AxisFault(HTTPTransportConstants.PROXY_PORT_ELEMENT_WITH_EMPTY_VALUE);
         }
         return Integer.parseInt(proxyPort);
     }
 
     private static String getProxyUser(OMElement proxyConfiguration) {
-        OMElement proxyUserElement = proxyConfiguration.getFirstChildWithName(new QName(PROXY_USER_ELEMENT));
+        OMElement proxyUserElement = proxyConfiguration.getFirstChildWithName(new QName(
+                HTTPTransportConstants.PROXY_USER_ELEMENT));
         if (proxyUserElement == null) {
             return null;
         }
@@ -222,7 +206,8 @@ public class HTTPProxyConfigurationUtil {
     }
 
     private static String getProxyPassword(OMElement proxyConfiguration) {
-        OMElement proxyPasswordElement = proxyConfiguration.getFirstChildWithName(new QName(PROXY_PASSWORD_ELEMENT));
+        OMElement proxyPasswordElement = proxyConfiguration.getFirstChildWithName(new QName(
+                HTTPTransportConstants.PROXY_PASSWORD_ELEMENT));
         if (proxyPasswordElement == null) {
             return null;
         }
@@ -236,24 +221,26 @@ public class HTTPProxyConfigurationUtil {
     }
 
     /**
-     * Check whether http proxy is configured or active.
-     * This is not a deep check.
-     *
-     * @param messageContext in message context
-     * @param targetURL      URL of the edpoint which we are sending the request
+     * Check whether http proxy is configured or active. This is not a deep
+     * check.
+     * 
+     * @param messageContext
+     *            in message context
+     * @param targetURL
+     *            URL of the edpoint which we are sending the request
      * @return true if proxy is enabled, false otherwise
      */
     public static boolean isProxyEnabled(MessageContext messageContext, URL targetURL) {
         boolean proxyEnabled = false;
 
         Parameter param = messageContext.getConfigurationContext().getAxisConfiguration()
-                .getParameter(ATTR_PROXY);
+                .getParameter(HTTPTransportConstants.ATTR_PROXY);
 
-        //If configuration is over ridden
+        // If configuration is over ridden
         Object obj = messageContext.getProperty(HTTPConstants.PROXY);
 
-        //From Java Networking Properties
-        String sp = System.getProperty(HTTP_PROXY_HOST);
+        // From Java Networking Properties
+        String sp = System.getProperty(HTTPTransportConstants.HTTP_PROXY_HOST);
 
         if (param != null || obj != null || sp != null) {
             proxyEnabled = true;
@@ -265,31 +252,35 @@ public class HTTPProxyConfigurationUtil {
     }
 
     /**
-     * Validates for names that shouldn't be listered as proxies.
-     * The http.nonProxyHosts can be set to specify the hosts which should be
-     * connected to directly (not through the proxy server).
-     * The value of the http.nonProxyHosts property can be a list of hosts,
-     * each separated by a |; it can also take a regular expression for matches;
-     * for example: *.sfbay.sun.com would match any fully qualified hostname in the sfbay domain.
+     * Validates for names that shouldn't be listered as proxies. The
+     * http.nonProxyHosts can be set to specify the hosts which should be
+     * connected to directly (not through the proxy server). The value of the
+     * http.nonProxyHosts property can be a list of hosts, each separated by a
+     * |; it can also take a regular expression for matches; for example:
+     * *.sfbay.sun.com would match any fully qualified hostname in the sfbay
+     * domain.
      * <p/>
-     * For more information refer to : http://java.sun.com/features/2002/11/hilevel_network.html
+     * For more information refer to :
+     * http://java.sun.com/features/2002/11/hilevel_network.html
      * <p/>
-     * false : validation fail : User can use the proxy
-     * true : validation pass ; User can't use the proxy
-     *
+     * false : validation fail : User can use the proxy true : validation pass ;
+     * User can't use the proxy
+     * 
      * @return boolean
      */
     private static boolean validateNonProxyHosts(String host) {
-        //From system property http.nonProxyHosts
-        String nonProxyHosts = System.getProperty(HTTP_NON_PROXY_HOSTS);
+        // From system property http.nonProxyHosts
+        String nonProxyHosts = System.getProperty(HTTPTransportConstants.HTTP_NON_PROXY_HOSTS);
         return isHostInNonProxyList(host, nonProxyHosts);
     }
 
     /**
      * Check if the specified host is in the list of non proxy hosts.
-     *
-     * @param host          host name
-     * @param nonProxyHosts string containing the list of non proxy hosts
+     * 
+     * @param host
+     *            host name
+     * @param nonProxyHosts
+     *            string containing the list of non proxy hosts
      * @return true/false
      */
     public static boolean isHostInNonProxyList(String host, String nonProxyHosts) {
@@ -298,8 +289,8 @@ public class HTTPProxyConfigurationUtil {
         }
 
         /*
-         * The http.nonProxyHosts system property is a list enclosed in
-         * double quotes with items separated by a vertical bar.
+         * The http.nonProxyHosts system property is a list enclosed in double
+         * quotes with items separated by a vertical bar.
          */
         StringTokenizer tokenizer = new StringTokenizer(nonProxyHosts, "|\"");
 
@@ -314,18 +305,17 @@ public class HTTPProxyConfigurationUtil {
 
     /**
      * Matches a string against a pattern. The pattern contains two special
-     * characters:
-     * '*' which means zero or more characters,
-     *
-     * @param pattern         the (non-null) pattern to match against
-     * @param str             the (non-null) string that must be matched against the
-     *                        pattern
+     * characters: '*' which means zero or more characters,
+     * 
+     * @param pattern
+     *            the (non-null) pattern to match against
+     * @param str
+     *            the (non-null) string that must be matched against the pattern
      * @param isCaseSensitive
      * @return <code>true</code> when the string matches against the pattern,
      *         <code>false</code> otherwise.
      */
-    private static boolean match(String pattern, String str,
-                                 boolean isCaseSensitive) {
+    private static boolean match(String pattern, String str, boolean isCaseSensitive) {
 
         char[] patArr = pattern.toCharArray();
         char[] strArr = str.toCharArray();
@@ -346,35 +336,32 @@ public class HTTPProxyConfigurationUtil {
 
             // No '*'s, so we make a shortcut
             if (patIdxEnd != strIdxEnd) {
-                return false;        // Pattern and string do not have the same size
+                return false; // Pattern and string do not have the same size
             }
             for (int i = 0; i <= patIdxEnd; i++) {
                 ch = patArr[i];
                 if (isCaseSensitive && (ch != strArr[i])) {
-                    return false;    // Character mismatch
+                    return false; // Character mismatch
                 }
                 if (!isCaseSensitive
-                        && (Character.toUpperCase(ch)
-                        != Character.toUpperCase(strArr[i]))) {
-                    return false;    // Character mismatch
+                        && (Character.toUpperCase(ch) != Character.toUpperCase(strArr[i]))) {
+                    return false; // Character mismatch
                 }
             }
-            return true;             // String matches against pattern
+            return true; // String matches against pattern
         }
         if (patIdxEnd == 0) {
-            return true;    // Pattern contains only '*', which matches anything
+            return true; // Pattern contains only '*', which matches anything
         }
 
         // Process characters before first star
-        while ((ch = patArr[patIdxStart]) != '*'
-                && (strIdxStart <= strIdxEnd)) {
+        while ((ch = patArr[patIdxStart]) != '*' && (strIdxStart <= strIdxEnd)) {
             if (isCaseSensitive && (ch != strArr[strIdxStart])) {
-                return false;    // Character mismatch
+                return false; // Character mismatch
             }
             if (!isCaseSensitive
-                    && (Character.toUpperCase(ch)
-                    != Character.toUpperCase(strArr[strIdxStart]))) {
-                return false;    // Character mismatch
+                    && (Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxStart]))) {
+                return false; // Character mismatch
             }
             patIdxStart++;
             strIdxStart++;
@@ -394,12 +381,11 @@ public class HTTPProxyConfigurationUtil {
         // Process characters after last star
         while ((ch = patArr[patIdxEnd]) != '*' && (strIdxStart <= strIdxEnd)) {
             if (isCaseSensitive && (ch != strArr[strIdxEnd])) {
-                return false;    // Character mismatch
+                return false; // Character mismatch
             }
             if (!isCaseSensitive
-                    && (Character.toUpperCase(ch)
-                    != Character.toUpperCase(strArr[strIdxEnd]))) {
-                return false;    // Character mismatch
+                    && (Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxEnd]))) {
+                return false; // Character mismatch
             }
             patIdxEnd--;
             strIdxEnd--;
@@ -440,17 +426,15 @@ public class HTTPProxyConfigurationUtil {
             int strLength = (strIdxEnd - strIdxStart + 1);
             int foundIdx = -1;
 
-            strLoop:
-            for (int i = 0; i <= strLength - patLength; i++) {
+            strLoop: for (int i = 0; i <= strLength - patLength; i++) {
                 for (int j = 0; j < patLength; j++) {
                     ch = patArr[patIdxStart + j + 1];
-                    if (isCaseSensitive
-                            && (ch != strArr[strIdxStart + i + j])) {
+                    if (isCaseSensitive && (ch != strArr[strIdxStart + i + j])) {
                         continue strLoop;
                     }
-                    if (!isCaseSensitive && (Character
-                            .toUpperCase(ch) != Character
-                            .toUpperCase(strArr[strIdxStart + i + j]))) {
+                    if (!isCaseSensitive
+                            && (Character.toUpperCase(ch) != Character
+                                    .toUpperCase(strArr[strIdxStart + i + j]))) {
                         continue strLoop;
                     }
                 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
similarity index 52%
copy from modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
copy to modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
index f02875a..4c5d7b8 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
@@ -17,31 +17,51 @@
  * under the License.
  */
 
-package org.apache.axis2.transport.http;
+package org.apache.axis2.transport.http.impl.httpclient3;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.GZIPInputStream;
+
+import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.NamedValue;
 import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.MessageFormatter;
 import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.transport.http.util.HTTPProxyConfigurationUtil;
+import org.apache.axis2.transport.http.HTTPAuthenticator;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.HTTPSender;
+import org.apache.axis2.transport.http.HTTPTransportConstants;
 import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.commons.httpclient.Credentials;
 import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HeaderElement;
-import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpConnectionManager;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+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.Credentials;
+import org.apache.commons.httpclient.HeaderElement;
+import org.apache.commons.httpclient.HostConfiguration;
+import org.apache.commons.httpclient.HttpConnectionManager;
 import org.apache.commons.httpclient.HttpState;
 import org.apache.commons.httpclient.HttpVersion;
 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
@@ -56,75 +76,306 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.http.protocol.HTTP;
 
-import javax.xml.namespace.QName;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.zip.GZIPInputStream;
+public class HTTPSenderImpl extends HTTPSender {
+
+    private static final Log log = LogFactory.getLog(HTTPSenderImpl.class);
 
-public abstract class AbstractHTTPSender {
-    protected static final String ANONYMOUS = "anonymous";
-    protected static final String PROXY_HOST_NAME = "proxy_host";
-    protected static final String PROXY_PORT = "proxy_port";
-    protected boolean chunked = false;
-    protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
-    private static final Log log = LogFactory.getLog(AbstractHTTPSender.class);
+    /**
+     * Used to send a request via HTTP Get method
+     * 
+     * @param msgContext
+     *            - The MessageContext of the message
+     * @param url
+     *            - The target URL
+     * @param soapActiionString
+     *            - The soapAction string of the request
+     * @throws AxisFault
+     *             - Thrown in case an exception occurs
+     */
+    protected void sendViaGet(MessageContext msgContext, URL url, String soapActiionString)
+            throws AxisFault {
+
+        GetMethod getMethod = new GetMethod();
+        HttpClient httpClient = getHttpClient(msgContext);
+        MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, getMethod,
+                httpClient, soapActiionString);
+
+        // Need to have this here because we can have soap action when using the
+        // soap response MEP
+        String soapAction = messageFormatter
+                .formatSOAPAction(msgContext, format, soapActiionString);
+
+        if (soapAction != null) {
+            getMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
+        }
+        try {
+            executeMethod(httpClient, msgContext, url, getMethod);
+            handleResponse(msgContext, getMethod);
+        } catch (IOException e) {
+            log.info("Unable to sendViaGet to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            cleanup(msgContext, getMethod);
+        }
+    }
 
-    protected static final String PROTOCOL_HTTP = "http";
-    protected static final String PROTOCOL_HTTPS = "https";
+    protected void cleanup(MessageContext msgContext, Object httpMmethod) {
+        if (httpMmethod instanceof HttpMethod) {
+            if (msgContext.isPropertyTrue(HTTPConstants.AUTO_RELEASE_CONNECTION)) {
+                log.trace("AutoReleasing " + httpMmethod);
+                ((HttpMethod) httpMmethod).releaseConnection();
+            }
+        }
+    }
 
     /**
-     * proxydiscription
+     * Used to send a request via HTTP Delete Method
+     * 
+     * @param msgContext
+     *            - The MessageContext of the message
+     * @param url
+     *            - The target URL
+     * @param soapActiionString
+     *            - The soapAction string of the request
+     * @throws AxisFault
+     *             - Thrown in case an exception occurs
      */
-    protected TransportOutDescription proxyOutSetting = null;
-    protected OMOutputFormat format = new OMOutputFormat();
+    protected void sendViaDelete(MessageContext msgContext, URL url, String soapActiionString)
+            throws AxisFault {
+
+        DeleteMethod deleteMethod = new DeleteMethod();
+        HttpClient httpClient = getHttpClient(msgContext);
+        populateCommonProperties(msgContext, url, deleteMethod, httpClient, soapActiionString);
+
+        try {
+            executeMethod(httpClient, msgContext, url, deleteMethod);
+            handleResponse(msgContext, deleteMethod);
+        } catch (IOException e) {
+            log.info("Unable to sendViaDelete to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            cleanup(msgContext, deleteMethod);
+        }
+    }
 
     /**
-     * isAllowedRetry will be using to check where the
-     * retry should be allowed or not.
+     * Used to send a request via HTTP Post Method
+     * 
+     * @param msgContext
+     *            - The MessageContext of the message
+     * @param url
+     *            - The target URL
+     * @param soapActionString
+     *            - The soapAction string of the request
+     * @throws AxisFault
+     *             - Thrown in case an exception occurs
      */
-    protected boolean isAllowedRetry = false;
+    protected void sendViaPost(MessageContext msgContext, URL url, String soapActionString)
+            throws AxisFault {
 
-    public void setChunked(boolean chunked) {
-        this.chunked = chunked;
+        HttpClient httpClient = getHttpClient(msgContext);
+
+        /*
+         * What's up with this, it never gets used anywhere?? --Glen String
+         * charEncoding = (String)
+         * msgContext.getProperty(Constants.Configuration
+         * .CHARACTER_SET_ENCODING);
+         * 
+         * if (charEncoding == null) { charEncoding =
+         * MessageContext.DEFAULT_CHAR_SET_ENCODING; }
+         */
+
+        PostMethod postMethod = new PostMethod();
+        if (log.isTraceEnabled()) {
+            log.trace(Thread.currentThread() + " PostMethod " + postMethod + " / " + httpClient);
+        }
+        MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, postMethod,
+                httpClient, soapActionString);
+
+        postMethod.setRequestEntity(new AxisRequestEntityImpl(messageFormatter, msgContext, format,
+                soapActionString, chunked, isAllowedRetry));
+
+        if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) {
+            postMethod.setContentChunked(true);
+        }
+
+        String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString);
+
+        if (soapAction != null) {
+            postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
+        }
+
+        /*
+         * main excecution takes place..
+         */
+        try {
+            executeMethod(httpClient, msgContext, url, postMethod);
+            handleResponse(msgContext, postMethod);
+        } catch (IOException e) {
+            log.info("Unable to sendViaPost to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            cleanup(msgContext, postMethod);
+        }
     }
 
-    public void setHttpVersion(String version) throws AxisFault {
-        if (version != null) {
-            if (HTTPConstants.HEADER_PROTOCOL_11.equals(version)) {
-                this.httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
-            } else if (HTTPConstants.HEADER_PROTOCOL_10.equals(version)) {
-                this.httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
-                // chunked is not possible with HTTP/1.0
-                this.chunked = false;
-            } else {
-                throw new AxisFault(
-                        "Parameter " + HTTPConstants.PROTOCOL_VERSION
-                                + " Can have values only HTTP/1.0 or HTTP/1.1");
+    /**
+     * Used to send a request via HTTP Put Method
+     * 
+     * @param msgContext
+     *            - The MessageContext of the message
+     * @param url
+     *            - The target URL
+     * @param soapActionString
+     *            - The soapAction string of the request
+     * @throws AxisFault
+     *             - Thrown in case an exception occurs
+     */
+    protected void sendViaPut(MessageContext msgContext, URL url, String soapActionString)
+            throws AxisFault {
+
+        HttpClient httpClient = getHttpClient(msgContext);
+
+        /*
+         * Same deal - this value never gets used, why is it here? --Glen String
+         * charEncoding = (String)
+         * msgContext.getProperty(Constants.Configuration
+         * .CHARACTER_SET_ENCODING);
+         * 
+         * if (charEncoding == null) { charEncoding =
+         * MessageContext.DEFAULT_CHAR_SET_ENCODING; }
+         */
+
+        PutMethod putMethod = new PutMethod();
+        MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, putMethod,
+                httpClient, soapActionString);
+
+        putMethod.setRequestEntity(new AxisRequestEntityImpl(messageFormatter, msgContext, format,
+                soapActionString, chunked, isAllowedRetry));
+
+        if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) {
+            putMethod.setContentChunked(true);
+        }
+
+        String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString);
+        if (soapAction != null) {
+            putMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
+        }
+
+        /*
+         * main excecution takes place..
+         */
+        try {
+            executeMethod(httpClient, msgContext, url, putMethod);
+            handleResponse(msgContext, putMethod);
+        } catch (IOException e) {
+            log.info("Unable to sendViaPut to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            cleanup(msgContext, putMethod);
+        }
+    }
+
+    /**
+     * Used to handle the HTTP Response
+     * 
+     * @param msgContext
+     *            - The MessageContext of the message
+     * @param method
+     *            - The HTTP method used
+     * @throws IOException
+     *             - Thrown in case an exception occurs
+     */
+    protected void handleResponse(MessageContext msgContext, Object httpMethodBase)
+            throws IOException {
+        HttpMethodBase method;
+        if (httpMethodBase instanceof HttpMethodBase) {
+            method = (HttpMethodBase) httpMethodBase;
+        } else {
+            log.trace("HttpMethodBase expected, but found - " + httpMethodBase);
+            return;
+        }
+        int statusCode = method.getStatusCode();
+        log.trace("Handling response - " + statusCode);
+        if (statusCode == HttpStatus.SC_OK) {
+            // Save the HttpMethod so that we can release the connection when
+            // cleaning up
+            msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
+            processResponse(method, msgContext);
+        } else if (statusCode == HttpStatus.SC_ACCEPTED) {
+            /*
+             * When an HTTP 202 Accepted code has been received, this will be
+             * the case of an execution of an in-only operation. In such a
+             * scenario, the HTTP response headers should be returned, i.e.
+             * session cookies.
+             */
+            obtainHTTPHeaderInformation(method, msgContext);
+            // Since we don't expect any content with a 202 response, we must
+            // release the connection
+            method.releaseConnection();
+        } else if (statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR
+                || statusCode == HttpStatus.SC_BAD_REQUEST) {
+            // Save the HttpMethod so that we can release the connection when
+            // cleaning up
+            msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
+            Header contenttypeHeader = method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+            String value = null;
+            if (contenttypeHeader != null) {
+                value = contenttypeHeader.getValue();
+            }
+            OperationContext opContext = msgContext.getOperationContext();
+            if (opContext != null) {
+                MessageContext inMessageContext = opContext
+                        .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+                if (inMessageContext != null) {
+                    inMessageContext.setProcessingFault(true);
+                }
+            }
+            if (value != null) {
+
+                processResponse(method, msgContext);
+            }
+
+            if (org.apache.axis2.util.Utils.isClientThreadNonBlockingPropertySet(msgContext)) {
+                throw new AxisFault(Messages.getMessage("transportError",
+                        String.valueOf(statusCode), method.getStatusText()));
             }
+        } else {
+            // Since we don't process the response, we must release the
+            // connection immediately
+            method.releaseConnection();
+            throw new AxisFault(Messages.getMessage("transportError", String.valueOf(statusCode),
+                    method.getStatusText()));
         }
     }
 
     /**
      * Collect the HTTP header information and set them in the message context
-     *
-     * @param method HttpMethodBase from which to get information
-     * @param msgContext the MessageContext in which to place the information... OR NOT!
-     * @throws AxisFault if problems occur
+     * 
+     * @param method
+     *            HttpMethodBase from which to get information
+     * @param msgContext
+     *            the MessageContext in which to place the information... OR
+     *            NOT!
+     * @throws AxisFault
+     *             if problems occur
      */
-    protected void obtainHTTPHeaderInformation(HttpMethodBase method,
-                                               MessageContext msgContext) throws AxisFault {
-        // Set RESPONSE properties onto the REQUEST message context.  They will need to be copied off the request context onto
-        // the response context elsewhere, for example in the OutInOperationClient.
-        Map transportHeaders = new CommonsTransportHeaders(method.getResponseHeaders());
+    protected void obtainHTTPHeaderInformation(Object httpMethodBase, MessageContext msgContext)
+            throws AxisFault {
+        HttpMethod method;
+        if (httpMethodBase instanceof HttpMethodBase) {
+            method = (HttpMethod) httpMethodBase;
+        } else {
+            return;
+        }
+        // Set RESPONSE properties onto the REQUEST message context. They will
+        // need to be copied off the request context onto
+        // the response context elsewhere, for example in the
+        // OutInOperationClient.
+        Map transportHeaders = new HTTPTransportHeaders(method.getResponseHeaders());
         msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, transportHeaders);
-        msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE, new Integer(method.getStatusCode()));
+        msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE,
+                new Integer(method.getStatusCode()));
         Header header = method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
 
         if (header != null) {
@@ -136,29 +387,29 @@ public abstract class AbstractHTTPSender {
             Object charSetEnc = null;
 
             for (int i = 0; i < headers.length; i++) {
-                NameValuePair charsetEnc = headers[i].getParameterByName(
-                        HTTPConstants.CHAR_SET_ENCODING);
+                NameValuePair charsetEnc = headers[i]
+                        .getParameterByName(HTTPConstants.CHAR_SET_ENCODING);
                 if (charsetEnc != null) {
                     charSetEnc = charsetEnc.getValue();
                 }
             }
 
             if (inMessageContext != null) {
-                inMessageContext
-                        .setProperty(Constants.Configuration.CONTENT_TYPE, contentType);
-                inMessageContext
-                        .setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
+                inMessageContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentType);
+                inMessageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
+                        charSetEnc);
             } else {
 
-                // Transport details will be stored in a HashMap so that anybody interested can
+                // Transport details will be stored in a HashMap so that anybody
+                // interested can
                 // retrieve them
                 HashMap transportInfoMap = new HashMap();
                 transportInfoMap.put(Constants.Configuration.CONTENT_TYPE, contentType);
                 transportInfoMap.put(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
 
-                //the HashMap is stored in the outgoing message.
-                msgContext.setProperty(Constants.Configuration.TRANSPORT_INFO_MAP,
-                                       transportInfoMap);
+                // the HashMap is stored in the outgoing message.
+                msgContext
+                        .setProperty(Constants.Configuration.TRANSPORT_INFO_MAP, transportInfoMap);
             }
         }
 
@@ -170,8 +421,8 @@ public abstract class AbstractHTTPSender {
             HeaderElement[] elements = cookieHeaders[i].getElements();
             for (int e = 0; e < elements.length; e++) {
                 HeaderElement element = elements[e];
-                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) ||
-                        Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
+                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName())
+                        || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
                     sessionCookie = processCookieHeader(element);
                 }
                 if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) {
@@ -185,11 +436,11 @@ public abstract class AbstractHTTPSender {
             HeaderElement[] elements = cookieHeaders[i].getElements();
             for (int e = 0; e < elements.length; e++) {
                 HeaderElement element = elements[e];
-                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) ||
-                        Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
+                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName())
+                        || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
                     sessionCookie = processCookieHeader(element);
                 }
-                if(customCoookiId!=null&&customCoookiId.equalsIgnoreCase(element.getName())){
+                if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) {
                     sessionCookie = processCookieHeader(element);
                 }
             }
@@ -202,7 +453,7 @@ public abstract class AbstractHTTPSender {
 
     private String processCookieHeader(HeaderElement element) {
         String cookie = element.getName() + "=" + element.getValue();
-        NameValuePair[] parameters =  element.getParameters();
+        NameValuePair[] parameters = element.getParameters();
         for (int j = 0; parameters != null && j < parameters.length; j++) {
             NameValuePair parameter = parameters[j];
             cookie = cookie + "; " + parameter.getName() + "=" + parameter.getValue();
@@ -210,8 +461,7 @@ public abstract class AbstractHTTPSender {
         return cookie;
     }
 
-    protected void processResponse(HttpMethodBase httpMethod,
-                                   MessageContext msgContext)
+    protected void processResponse(HttpMethodBase httpMethod, MessageContext msgContext)
             throws IOException {
         obtainHTTPHeaderInformation(httpMethod, msgContext);
 
@@ -219,13 +469,13 @@ public abstract class AbstractHTTPSender {
         if (in == null) {
             throw new AxisFault(Messages.getMessage("canNotBeNull", "InputStream"));
         }
-        Header contentEncoding =
-                httpMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_ENCODING);
+        Header contentEncoding = httpMethod
+                .getResponseHeader(HTTPConstants.HEADER_CONTENT_ENCODING);
         if (contentEncoding != null) {
-            if (contentEncoding.getValue().
-                    equalsIgnoreCase(HTTPConstants.COMPRESSION_GZIP)) {
+            if (contentEncoding.getValue().equalsIgnoreCase(HTTPConstants.COMPRESSION_GZIP)) {
                 in = new GZIPInputStream(in);
-                // If the content-encoding is identity we can basically ignore it.
+                // If the content-encoding is identity we can basically ignore
+                // it.
             } else if (!"identity".equalsIgnoreCase(contentEncoding.getValue())) {
                 throw new AxisFault("HTTP :" + "unsupported content-encoding of '"
                         + contentEncoding.getValue() + "' found");
@@ -238,44 +488,48 @@ public abstract class AbstractHTTPSender {
         }
     }
 
-    public abstract void send(MessageContext msgContext, URL url, String soapActionString)
-            throws IOException;
-
     /**
-     * getting host configuration to support standard http/s, proxy and NTLM support
-     *
-     * @param client active HttpClient
-     * @param msgCtx active MessageContext
-     * @param targetURL the target URL
+     * getting host configuration to support standard http/s, proxy and NTLM
+     * support
+     * 
+     * @param client
+     *            active HttpClient
+     * @param msgCtx
+     *            active MessageContext
+     * @param targetURL
+     *            the target URL
      * @return a HostConfiguration set up with proxy information
-     * @throws AxisFault if problems occur
+     * @throws AxisFault
+     *             if problems occur
      */
-    protected HostConfiguration getHostConfiguration(HttpClient client,
-                                                     MessageContext msgCtx,
-                                                     URL targetURL)throws AxisFault {
+    protected HostConfiguration getHostConfiguration(HttpClient client, MessageContext msgCtx,
+            URL targetURL) throws AxisFault {
 
         boolean isAuthenticationEnabled = isAuthenticationEnabled(msgCtx);
         int port = targetURL.getPort();
 
         String protocol = targetURL.getProtocol();
         if (port == -1) {
-            if (PROTOCOL_HTTP.equals(protocol)) {
+            if (HTTPTransportConstants.PROTOCOL_HTTP.equals(protocol)) {
                 port = 80;
-            } else if (PROTOCOL_HTTPS.equals(protocol)) {
+            } else if (HTTPTransportConstants.PROTOCOL_HTTPS.equals(protocol)) {
                 port = 443;
             }
 
         }
 
-        // to see the host is a proxy and in the proxy list - available in axis2.xml
+        // to see the host is a proxy and in the proxy list - available in
+        // axis2.xml
         HostConfiguration config = new HostConfiguration();
 
-        // one might need to set his own socket factory. Let's allow that case as well.
-        Protocol protocolHandler =
-                (Protocol)msgCtx.getOptions().getProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER);
+        // one might need to set his own socket factory. Let's allow that case
+        // as well.
+        Protocol protocolHandler = (Protocol) msgCtx.getOptions().getProperty(
+                HTTPConstants.CUSTOM_PROTOCOL_HANDLER);
 
         // setting the real host configuration
-        // I assume the 90% case, or even 99% case will be no protocol handler case.
+        // I assume the 90% case, or even 99% case will be no protocol handler
+        // case.
         if (protocolHandler == null) {
             config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
         } else {
@@ -288,11 +542,11 @@ public abstract class AbstractHTTPSender {
         }
         // proxy configuration
 
-        if (HTTPProxyConfigurationUtil.isProxyEnabled(msgCtx, targetURL)) {
-            if(log.isDebugEnabled()){
+        if (HTTPProxcyConfigurator.isProxyEnabled(msgCtx, targetURL)) {
+            if (log.isDebugEnabled()) {
                 log.debug("Configuring HTTP proxy.");
             }
-            HTTPProxyConfigurationUtil.configure(msgCtx, client, config);
+            HTTPProxcyConfigurator.configure(msgCtx, client, config);
         }
 
         return config;
@@ -303,17 +557,17 @@ public abstract class AbstractHTTPSender {
     }
 
     /*
-    This will handle server Authentication, It could be either NTLM, Digest or Basic Authentication.
-    Apart from that user can change the priory or add a custom authentication scheme.
-    */
-    protected void setAuthenticationInfo(HttpClient agent,
-                                         MessageContext msgCtx,
-                                         HostConfiguration config) throws AxisFault {
-        HttpTransportProperties.Authenticator authenticator;
+     * This will handle server Authentication, It could be either NTLM, Digest
+     * or Basic Authentication. Apart from that user can change the priory or
+     * add a custom authentication scheme.
+     */
+    protected void setAuthenticationInfo(HttpClient agent, MessageContext msgCtx,
+            HostConfiguration config) throws AxisFault {
+        HTTPAuthenticator authenticator;
         Object obj = msgCtx.getProperty(HTTPConstants.AUTHENTICATE);
         if (obj != null) {
-            if (obj instanceof HttpTransportProperties.Authenticator) {
-                authenticator = (HttpTransportProperties.Authenticator) obj;
+            if (obj instanceof HTTPAuthenticator) {
+                authenticator = (HTTPAuthenticator) obj;
 
                 String username = authenticator.getUsername();
                 String password = authenticator.getPassword();
@@ -329,33 +583,37 @@ public abstract class AbstractHTTPSender {
                 Credentials creds;
 
                 HttpState tmpHttpState = null;
-                HttpState httpState = (HttpState)msgCtx.getProperty(HTTPConstants.CACHED_HTTP_STATE);
+                HttpState httpState = (HttpState) msgCtx
+                        .getProperty(HTTPConstants.CACHED_HTTP_STATE);
                 if (httpState != null) {
                     tmpHttpState = httpState;
                 } else {
                     tmpHttpState = agent.getState();
                 }
-                
-                agent.getParams()
-                        .setAuthenticationPreemptive(authenticator.getPreemptiveAuthentication());
+
+                agent.getParams().setAuthenticationPreemptive(
+                        authenticator.getPreemptiveAuthentication());
 
                 if (host != null) {
                     if (domain != null) {
-                        /*Credentials for NTLM Authentication*/
+                        /* Credentials for NTLM Authentication */
                         creds = new NTCredentials(username, password, host, domain);
                     } else {
-                        /*Credentials for Digest and Basic Authentication*/
+                        /* Credentials for Digest and Basic Authentication */
                         creds = new UsernamePasswordCredentials(username, password);
                     }
                     tmpHttpState.setCredentials(new AuthScope(host, port, realm), creds);
                 } else {
                     if (domain != null) {
-                        /*Credentials for NTLM Authentication when host is ANY_HOST*/
+                        /*
+                         * Credentials for NTLM Authentication when host is
+                         * ANY_HOST
+                         */
                         creds = new NTCredentials(username, password, AuthScope.ANY_HOST, domain);
-                        tmpHttpState.setCredentials(
-                                new AuthScope(AuthScope.ANY_HOST, port, realm), creds);
+                        tmpHttpState.setCredentials(new AuthScope(AuthScope.ANY_HOST, port, realm),
+                                creds);
                     } else {
-                        /*Credentials only for Digest and Basic Authentication*/
+                        /* Credentials only for Digest and Basic Authentication */
                         creds = new UsernamePasswordCredentials(username, password);
                         tmpHttpState.setCredentials(new AuthScope(AuthScope.ANY), creds);
                     }
@@ -370,16 +628,10 @@ public abstract class AbstractHTTPSender {
                             continue;
                         }
                         String scheme = (String) schemes.get(i);
-                        if (HttpTransportProperties.Authenticator.BASIC.equals(scheme)) {
-                            authPrefs.add(AuthPolicy.BASIC);
-                        } else if (HttpTransportProperties.Authenticator.NTLM.equals(scheme)) {
-                            authPrefs.add(AuthPolicy.NTLM);
-                        } else if (HttpTransportProperties.Authenticator.DIGEST.equals(scheme)) {
-                            authPrefs.add(AuthPolicy.DIGEST);
-                        }
+                        authPrefs.add(authenticator.getAuthPolicyPref(scheme));
+
                     }
-                    agent.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY,
-                            authPrefs);
+                    agent.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
                 }
 
             } else {
@@ -391,27 +643,31 @@ public abstract class AbstractHTTPSender {
 
     /**
      * Method used to copy all the common properties
-     *
-     * @param msgContext       - The messageContext of the request message
-     * @param url              - The target URL
-     * @param httpMethod       - The http method used to send the request
-     * @param httpClient       - The httpclient used to send the request
-     * @param soapActionString - The soap action atring of the request message
-     * @return MessageFormatter - The messageFormatter for the relavent request message
-     * @throws AxisFault - Thrown in case an exception occurs
+     * 
+     * @param msgContext
+     *            - The messageContext of the request message
+     * @param url
+     *            - The target URL
+     * @param httpMethod
+     *            - The http method used to send the request
+     * @param httpClient
+     *            - The httpclient used to send the request
+     * @param soapActionString
+     *            - The soap action atring of the request message
+     * @return MessageFormatter - The messageFormatter for the relavent request
+     *         message
+     * @throws AxisFault
+     *             - Thrown in case an exception occurs
      */
     protected MessageFormatter populateCommonProperties(MessageContext msgContext, URL url,
-                                                      HttpMethodBase httpMethod,
-                                                      HttpClient httpClient,
-                                                      String soapActionString)
+            HttpMethodBase httpMethod, HttpClient httpClient, String soapActionString)
             throws AxisFault {
 
         if (isAuthenticationEnabled(msgContext)) {
             httpMethod.setDoAuthentication(true);
         }
 
-        MessageFormatter messageFormatter = TransportUtils.getMessageFormatter(
-                msgContext);
+        MessageFormatter messageFormatter = TransportUtils.getMessageFormatter(msgContext);
 
         url = messageFormatter.getTargetAddress(msgContext, format, url);
 
@@ -420,8 +676,7 @@ public abstract class AbstractHTTPSender {
         httpMethod.setQueryString(url.getQuery());
 
         httpMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
-                                    messageFormatter.getContentType(msgContext, format,
-                                                                    soapActionString));
+                messageFormatter.getContentType(msgContext, format, soapActionString));
 
         httpMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url.getHost());
 
@@ -443,31 +698,32 @@ public abstract class AbstractHTTPSender {
     }
 
     /**
-     * This is used to get the dynamically set time out values from the
-     * message context. If the values are not available or invalid then
-     * the default values or the values set by the configuration will be used
-     *
-     * @param msgContext the active MessageContext
+     * This is used to get the dynamically set time out values from the message
+     * context. If the values are not available or invalid then the default
+     * values or the values set by the configuration will be used
+     * 
+     * @param msgContext
+     *            the active MessageContext
      * @param httpClient
      */
     protected void initializeTimeouts(MessageContext msgContext, HttpClient httpClient) {
         // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
         // override the static config
-        Integer tempSoTimeoutProperty =
-                (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT);
-        Integer tempConnTimeoutProperty =
-                (Integer) msgContext
-                        .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
+        Integer tempSoTimeoutProperty = (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT);
+        Integer tempConnTimeoutProperty = (Integer) msgContext
+                .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
         long timeout = msgContext.getOptions().getTimeOutInMilliSeconds();
 
         if (tempConnTimeoutProperty != null) {
             int connectionTimeout = tempConnTimeoutProperty.intValue();
             // timeout for initial connection
-            httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(connectionTimeout);
+            httpClient.getHttpConnectionManager().getParams()
+                    .setConnectionTimeout(connectionTimeout);
         } else {
             // set timeout in client
             if (timeout > 0) {
-                httpClient.getHttpConnectionManager().getParams().setConnectionTimeout((int) timeout);
+                httpClient.getHttpConnectionManager().getParams()
+                        .setConnectionTimeout((int) timeout);
             }
         }
 
@@ -486,27 +742,26 @@ public abstract class AbstractHTTPSender {
     }
 
     /**
-     * This is used to get the dynamically set time out values from the
-     * message context. If the values are not available or invalid then
-     * the default values or the values set by the configuration will be used
-     *
-     * @param msgContext the active MessageContext
-     * @param httpMethod method
+     * This is used to get the dynamically set time out values from the message
+     * context. If the values are not available or invalid then the default
+     * values or the values set by the configuration will be used
+     * 
+     * @param msgContext
+     *            the active MessageContext
+     * @param httpMethod
+     *            method
      */
     protected void setTimeouts(MessageContext msgContext, HttpMethod httpMethod) {
         // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
         // override the static config
-        Integer tempSoTimeoutProperty =
-                (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT);
-        Integer tempConnTimeoutProperty =
-                (Integer) msgContext
-                        .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
+        Integer tempSoTimeoutProperty = (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT);
+        Integer tempConnTimeoutProperty = (Integer) msgContext
+                .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
         long timeout = msgContext.getOptions().getTimeOutInMilliSeconds();
 
         if (tempConnTimeoutProperty != null) {
             // timeout for initial connection
-            httpMethod.getParams().setParameter("http.connection.timeout",
-                    tempConnTimeoutProperty);
+            httpMethod.getParams().setParameter("http.connection.timeout", tempConnTimeoutProperty);
         }
 
         if (tempSoTimeoutProperty != null) {
@@ -520,15 +775,11 @@ public abstract class AbstractHTTPSender {
         }
     }
 
-    public void setFormat(OMOutputFormat format) {
-        this.format = format;
-    }
-
     protected HttpClient getHttpClient(MessageContext msgContext) {
         ConfigurationContext configContext = msgContext.getConfigurationContext();
 
-        HttpClient httpClient = (HttpClient) msgContext.getProperty(
-                HTTPConstants.CACHED_HTTP_CLIENT);
+        HttpClient httpClient = (HttpClient) msgContext
+                .getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
 
         if (httpClient == null) {
             httpClient = (HttpClient) configContext.getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
@@ -542,27 +793,25 @@ public abstract class AbstractHTTPSender {
             httpClient = (HttpClient) msgContext.getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
 
             if (httpClient == null) {
-                httpClient = (HttpClient) configContext.getProperty(
-                        HTTPConstants.CACHED_HTTP_CLIENT);
+                httpClient = (HttpClient) configContext
+                        .getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
             }
 
             if (httpClient != null) {
                 return httpClient;
             }
 
-            HttpConnectionManager connManager =
-                    (HttpConnectionManager) msgContext.getProperty(
-                            HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
+            HttpConnectionManager connManager = (HttpConnectionManager) msgContext
+                    .getProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
             if (connManager == null) {
-                connManager =
-                        (HttpConnectionManager) msgContext.getProperty(
-                                HTTPConstants.MUTTITHREAD_HTTP_CONNECTION_MANAGER);
+                connManager = (HttpConnectionManager) msgContext
+                        .getProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
             }
             if (connManager == null) {
                 // reuse HttpConnectionManager
                 synchronized (configContext) {
-                    connManager = (HttpConnectionManager) configContext.getProperty(
-                            HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
+                    connManager = (HttpConnectionManager) configContext
+                            .getProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
                     if (connManager == null) {
                         log.trace("Making new ConnectionManager");
                         connManager = new MultiThreadedHttpConnectionManager();
@@ -572,12 +821,13 @@ public abstract class AbstractHTTPSender {
                 }
             }
             /*
-             * Create a new instance of HttpClient since the way
-             * it is used here it's not fully thread-safe.
+             * Create a new instance of HttpClient since the way it is used here
+             * it's not fully thread-safe.
              */
             httpClient = new HttpClient(connManager);
 
-            // Set the default timeout in case we have a connection pool starvation to 30sec
+            // Set the default timeout in case we have a connection pool
+            // starvation to 30sec
             httpClient.getParams().setConnectionManagerTimeout(30000);
 
             // Get the timeout values set in the runtime
@@ -588,7 +838,7 @@ public abstract class AbstractHTTPSender {
     }
 
     protected void executeMethod(HttpClient httpClient, MessageContext msgContext, URL url,
-                                 HttpMethod method) throws IOException {
+            HttpMethod method) throws IOException {
         HostConfiguration config = this.getHostConfiguration(httpClient, msgContext, url);
 
         // set the custom headers, if available
@@ -604,18 +854,18 @@ public abstract class AbstractHTTPSender {
             method.addRequestHeader(HTTPConstants.HEADER_CONTENT_ENCODING,
                     HTTPConstants.COMPRESSION_GZIP);
         }
-        
+
         if (msgContext.getProperty(HTTPConstants.HTTP_METHOD_PARAMS) != null) {
-            HttpMethodParams params = (HttpMethodParams)msgContext
+            HttpMethodParams params = (HttpMethodParams) msgContext
                     .getProperty(HTTPConstants.HTTP_METHOD_PARAMS);
             method.setParams(params);
         }
 
         String cookiePolicy = (String) msgContext.getProperty(HTTPConstants.COOKIE_POLICY);
         if (cookiePolicy != null) {
-            method.getParams().setCookiePolicy(cookiePolicy);   
+            method.getParams().setCookiePolicy(cookiePolicy);
         }
-        HttpState httpState = (HttpState)msgContext.getProperty(HTTPConstants.CACHED_HTTP_STATE);
+        HttpState httpState = (HttpState) msgContext.getProperty(HTTPConstants.CACHED_HTTP_STATE);
 
         setTimeouts(msgContext, method);
 
@@ -640,12 +890,12 @@ public abstract class AbstractHTTPSender {
                         method.addRequestHeader(header);
                     }
                 }
-    
+
             }
             if (httpHeadersObj instanceof Map) {
                 Map httpHeaders = (Map) httpHeadersObj;
                 for (Iterator iterator = httpHeaders.entrySet().iterator(); iterator.hasNext();) {
-                    Map.Entry entry  = (Map.Entry) iterator.next();
+                    Map.Entry entry = (Map.Entry) iterator.next();
                     String key = (String) entry.getKey();
                     String value = (String) entry.getValue();
                     if (HTTPConstants.HEADER_USER_AGENT.equals(key)) {
@@ -669,8 +919,8 @@ public abstract class AbstractHTTPSender {
 
                     boolean headerAdded = false;
                     for (Header header : headers) {
-                        if (header.getName() != null &&                                 
-                                header.getName().equals(((Map.Entry) headerEntry).getKey())) {
+                        if (header.getName() != null
+                                && header.getName().equals(((Map.Entry) headerEntry).getKey())) {
                             headerAdded = true;
                             break;
                         }
@@ -691,13 +941,15 @@ public abstract class AbstractHTTPSender {
 
     }
 
-
     /**
-     * Remove unwanted headers from the transport headers map of outgoing request. These are headers which
-     * should be dictated by the transport and not the user. We remove these as these may get
-     * copied from the request messages
-     *
-     * @param msgContext the Axis2 Message context from which these headers should be removed
+     * Remove unwanted headers from the transport headers map of outgoing
+     * request. These are headers which should be dictated by the transport and
+     * not the user. We remove these as these may get copied from the request
+     * messages
+     * 
+     * @param msgContext
+     *            the Axis2 Message context from which these headers should be
+     *            removed
      */
     private void removeUnwantedHeaders(MessageContext msgContext) {
         Map headers = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
@@ -709,11 +961,11 @@ public abstract class AbstractHTTPSender {
         Iterator iter = headers.keySet().iterator();
         while (iter.hasNext()) {
             String headerName = (String) iter.next();
-            if (HTTP.CONN_DIRECTIVE.equalsIgnoreCase(headerName) ||
-                HTTP.TRANSFER_ENCODING.equalsIgnoreCase(headerName) ||
-                HTTP.DATE_HEADER.equalsIgnoreCase(headerName) ||
-                HTTP.CONTENT_TYPE.equalsIgnoreCase(headerName) ||
-                HTTP.CONTENT_LEN.equalsIgnoreCase(headerName)) {
+            if (HTTP.CONN_DIRECTIVE.equalsIgnoreCase(headerName)
+                    || HTTP.TRANSFER_ENCODING.equalsIgnoreCase(headerName)
+                    || HTTP.DATE_HEADER.equalsIgnoreCase(headerName)
+                    || HTTP.CONTENT_TYPE.equalsIgnoreCase(headerName)
+                    || HTTP.CONTENT_LEN.equalsIgnoreCase(headerName)) {
                 iter.remove();
             }
         }
@@ -723,8 +975,8 @@ public abstract class AbstractHTTPSender {
         String userAgentString = "Axis2";
         boolean locked = false;
         if (messageContext.getParameter(HTTPConstants.USER_AGENT) != null) {
-            OMElement userAgentElement =
-                    messageContext.getParameter(HTTPConstants.USER_AGENT).getParameterElement();
+            OMElement userAgentElement = messageContext.getParameter(HTTPConstants.USER_AGENT)
+                    .getParameterElement();
             userAgentString = userAgentElement.getText().trim();
             OMAttribute lockedAttribute = userAgentElement.getAttribute(new QName("locked"));
             if (lockedAttribute != null) {
@@ -742,5 +994,5 @@ public abstract class AbstractHTTPSender {
 
         return userAgentString;
     }
-    
+
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPTransportHeaders.java
similarity index 50%
copy from modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
copy to modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPTransportHeaders.java
index 81a3c6e..6f6deac 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPTransportHeaders.java
@@ -17,35 +17,27 @@
  * under the License.
  */
 
-package org.apache.axis2.transport.http;
+package org.apache.axis2.transport.http.impl.httpclient3;
 
-import org.apache.commons.httpclient.methods.RequestEntity;
+import java.util.HashMap;
 
-import java.io.IOException;
-import java.io.OutputStream;
+import org.apache.axis2.transport.http.CommonsTransportHeaders;
+import org.apache.commons.httpclient.Header;
 
-public class RESTRequestEntity2 implements RequestEntity {
-    private String contentType;
-    private String postRequestBody;
+public class HTTPTransportHeaders extends CommonsTransportHeaders {
 
-    public RESTRequestEntity2(String postRequestBody, String contentType) {
-        this.postRequestBody = postRequestBody;
-        this.contentType = contentType;
-    }
+    private Header[] headers;
 
-    public void writeRequest(OutputStream output) throws IOException {
-        output.write(postRequestBody.getBytes());
-    }
+    public HTTPTransportHeaders(Header[] headers) {
+        this.headers = headers;
 
-    public long getContentLength() {
-        return this.postRequestBody.getBytes().length;
     }
 
-    public String getContentType() {
-        return this.contentType;
+    protected void init() {
+        setHeaderMap(new HashMap());
+        for (int i = 0; i < headers.length; i++) {
+            getHeaderMap().put(headers[i].getName(), headers[i].getValue());
+        }
     }
 
-    public boolean isRepeatable() {
-        return true;
-    }
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HttpTransportPropertiesImpl.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HttpTransportPropertiesImpl.java
new file mode 100644
index 0000000..502611e
--- /dev/null
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HttpTransportPropertiesImpl.java
@@ -0,0 +1,90 @@
+/*
+ * 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.httpclient3;
+
+import org.apache.axis2.transport.http.HTTPAuthenticator;
+import org.apache.axis2.transport.http.HttpTransportProperties;
+import org.apache.commons.httpclient.HttpVersion;
+import org.apache.commons.httpclient.auth.AuthPolicy;
+import org.apache.commons.httpclient.auth.AuthScope;
+
+public class HttpTransportPropertiesImpl extends HttpTransportProperties {
+
+    protected HttpVersion httpVersion;
+
+    @Override
+    public void setHttpVersion(Object httpVerion) {
+        this.httpVersion = (HttpVersion) httpVerion;
+    }
+
+    @Override
+    public Object getHttpVersion() {
+        return this.httpVersion;
+    }
+
+    /*
+     * This class is responsible for holding all the necessary information
+     * needed for NTML, Digest and Basic Authentication. Authentication itself
+     * is handled by httpclient. User doesn't need to warry about what
+     * authentication mechanism it uses. Axis2 uses httpclinet's default
+     * authentication patterns.
+     */
+    public static class Authenticator extends HTTPAuthenticator {
+
+        /* port of the host that needed to be authenticated with */
+        private int port = AuthScope.ANY_PORT;
+        /* Realm for authentication scope */
+        private String realm = AuthScope.ANY_REALM;
+        /* Default Auth Schems */
+        public static final String NTLM = AuthPolicy.NTLM;
+        public static final String DIGEST = AuthPolicy.DIGEST;
+        public static final String BASIC = AuthPolicy.BASIC;
+
+        public int getPort() {
+            return port;
+        }
+
+        public void setPort(int port) {
+            this.port = port;
+        }
+
+        public String getRealm() {
+            return realm;
+        }
+
+        public void setRealm(String realm) {
+            this.realm = realm;
+        }
+
+        @Override
+        public Object getAuthPolicyPref(String scheme) {
+            if (BASIC.equals(scheme)) {
+                return AuthPolicy.BASIC;
+            } else if (NTLM.equals(scheme)) {
+                return AuthPolicy.NTLM;
+            } else if (DIGEST.equals(scheme)) {
+                return AuthPolicy.DIGEST;
+            }
+            return null;
+        }
+
+    }
+
+}
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/RESTRequestEntity2Impl.java
similarity index 56%
copy from modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
copy to modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/RESTRequestEntity2Impl.java
index 81a3c6e..2ccf3c8 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/RESTRequestEntity2Impl.java
@@ -17,35 +17,19 @@
  * under the License.
  */
 
-package org.apache.axis2.transport.http;
+package org.apache.axis2.transport.http.impl.httpclient3;
 
+import org.apache.axis2.transport.http.RESTRequestEntity2;
 import org.apache.commons.httpclient.methods.RequestEntity;
 
-import java.io.IOException;
-import java.io.OutputStream;
+public class RESTRequestEntity2Impl extends RESTRequestEntity2 implements RequestEntity {
 
-public class RESTRequestEntity2 implements RequestEntity {
-    private String contentType;
-    private String postRequestBody;
-
-    public RESTRequestEntity2(String postRequestBody, String contentType) {
-        this.postRequestBody = postRequestBody;
-        this.contentType = contentType;
-    }
-
-    public void writeRequest(OutputStream output) throws IOException {
-        output.write(postRequestBody.getBytes());
-    }
-
-    public long getContentLength() {
-        return this.postRequestBody.getBytes().length;
+    public RESTRequestEntity2Impl(String postRequestBody, String contentType) {
+        super(postRequestBody, contentType);
     }
 
     public String getContentType() {
-        return this.contentType;
+        return getContentTypeAsString();
     }
 
-    public boolean isRepeatable() {
-        return true;
-    }
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/RESTRequestEntityImpl.java
similarity index 56%
copy from modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
copy to modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/RESTRequestEntityImpl.java
index 81a3c6e..387729a 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/RESTRequestEntity2.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/RESTRequestEntityImpl.java
@@ -17,35 +17,23 @@
  * under the License.
  */
 
-package org.apache.axis2.transport.http;
+package org.apache.axis2.transport.http.impl.httpclient3;
 
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.http.RESTRequestEntity;
 import org.apache.commons.httpclient.methods.RequestEntity;
 
-import java.io.IOException;
-import java.io.OutputStream;
+public class RESTRequestEntityImpl extends RESTRequestEntity implements RequestEntity {
 
-public class RESTRequestEntity2 implements RequestEntity {
-    private String contentType;
-    private String postRequestBody;
-
-    public RESTRequestEntity2(String postRequestBody, String contentType) {
-        this.postRequestBody = postRequestBody;
-        this.contentType = contentType;
-    }
-
-    public void writeRequest(OutputStream output) throws IOException {
-        output.write(postRequestBody.getBytes());
-    }
-
-    public long getContentLength() {
-        return this.postRequestBody.getBytes().length;
+    public RESTRequestEntityImpl(OMElement element, boolean chunked, MessageContext msgCtxt,
+            String charSetEncoding, String soapActionString, OMOutputFormat format) {
+        super(element, chunked, msgCtxt, charSetEncoding, soapActionString, format);
     }
 
     public String getContentType() {
-        return this.contentType;
+        return getContentTypeAsString();
     }
 
-    public boolean isRepeatable() {
-        return true;
-    }
 }
diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/util/HTTPProxyConfigurationUtil.java b/modules/transport/http/src/org/apache/axis2/transport/http/util/HTTPProxyConfigurationUtil.java
index a163450..dcd7b90 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/util/HTTPProxyConfigurationUtil.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/util/HTTPProxyConfigurationUtil.java
@@ -42,6 +42,7 @@ import java.util.StringTokenizer;
 /**
  * Contains utility functions used when configuring HTTP Proxy for HTTP Sender.
  */
+@Deprecated
 public class HTTPProxyConfigurationUtil {
     private static Log log = LogFactory.getLog(HTTPProxyConfigurationUtil.class);
 


[axis-axis2-java-core] 15/15: Applied latest patch.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit 274b195b6e417d5339e162f119a5ffb9c52511d6
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Mon May 21 12:14:14 2012 +0000

    Applied latest patch.
---
 .../http/impl/httpclient4/HTTPSenderImpl.java      | 32 ++++++++++++++--------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
index 7723730..0c79ab0 100644
--- a/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
+++ b/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
@@ -58,6 +58,8 @@ import org.apache.http.client.methods.HttpRequestBase;
 import org.apache.http.client.params.AuthPolicy;
 import org.apache.http.client.params.ClientPNames;
 import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.params.ConnManagerPNames;
+import org.apache.http.conn.params.ConnPerRouteBean;
 import org.apache.http.conn.scheme.PlainSocketFactory;
 import org.apache.http.conn.scheme.Scheme;
 import org.apache.http.conn.scheme.SchemeRegistry;
@@ -318,21 +320,21 @@ public class HTTPSenderImpl extends HTTPSender {
         int statusCode = response.getStatusLine().getStatusCode();
         HTTPStatusCodeFamily family = getHTTPStatusCodeFamily(statusCode);
         log.trace("Handling response - " + statusCode);
-        if (HTTPStatusCodeFamily.SUCCESSFUL.equals(family)) {
+        if (statusCode == HttpStatus.SC_ACCEPTED) {
+            /*
+            * When an HTTP 202 Accepted code has been received, this will be
+            * the case of an execution of an in-only operation. In such a
+            * scenario, the HTTP response headers should be returned, i.e.
+            * session cookies.
+            */
+            obtainHTTPHeaderInformation(response, msgContext);
+
+        } else if (HTTPStatusCodeFamily.SUCCESSFUL.equals(family)) {
             // Save the HttpMethod so that we can release the connection when
             // cleaning up
             // TODO : Do we need to save the http method
 //            msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
-
             processResponse(response, msgContext);
-        } else if (statusCode == HttpStatus.SC_ACCEPTED) {
-            /*
-             * When an HTTP 202 Accepted code has been received, this will be
-             * the case of an execution of an in-only operation. In such a
-             * scenario, the HTTP response headers should be returned, i.e.
-             * session cookies.
-             */
-            obtainHTTPHeaderInformation(response.getEntity(), msgContext);
 
         } else if (statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR
                    || statusCode == HttpStatus.SC_BAD_REQUEST) {
@@ -813,7 +815,11 @@ public class HTTPSenderImpl extends HTTPSender {
                         schemeRegistry.register(
                                 new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
 
-                        connManager = new ThreadSafeClientConnManager(new BasicHttpParams(),
+                        HttpParams params = new BasicHttpParams();
+                        params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30);
+                        params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE,
+                                            new ConnPerRouteBean(30));
+                        connManager = new ThreadSafeClientConnManager(params,
                                                                       schemeRegistry);
                         configContext.setProperty(
                                 HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER, connManager);
@@ -824,7 +830,9 @@ public class HTTPSenderImpl extends HTTPSender {
              * Create a new instance of HttpClient since the way it is used here
              * it's not fully thread-safe.
              */
-            httpClient = new DefaultHttpClient(connManager, null);
+            HttpParams clientParams = new BasicHttpParams();
+            clientParams.setParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET, "UTF-8");
+            httpClient = new DefaultHttpClient(connManager, clientParams);
 
             //We don't need to set timeout for connection manager, since we are doing it below
             // and its enough


[axis-axis2-java-core] 03/15: Merged r1230421 to the AXIS2-4318 branch.

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch AXIS2-4318
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit 8fa50d54e6a7bcfcb4a95e9bf537145b7cf07489
Merge: f58edf0 37456e2
Author: Sagara Gunathunga <sa...@apache.org>
AuthorDate: Thu Jan 12 07:31:12 2012 +0000

    Merged r1230421 to the AXIS2-4318 branch.

 modules/osgi/pom.xml                             |  1 -
 modules/tool/archetype/quickstart-webapp/pom.xml |  3 ++-
 modules/tool/archetype/quickstart/pom.xml        |  3 ++-
 modules/tool/simple-server-maven-plugin/pom.xml  |  3 ++-
 modules/transport/http/pom.xml                   | 11 -----------
 5 files changed, 6 insertions(+), 15 deletions(-)