Author: veithen
Date: Sun Jan 15 21:15:53 2017
New Revision: 1778946

URL: http://svn.apache.org/viewvc?rev=1778946&view=rev
Log:
Trivial refactoring: transform anonymous Request subclasses into named classes.

Added:
    
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/DeleteRequest.java
    
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/GetRequest.java
    
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/PostRequest.java
    
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/PutRequest.java
    
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/DeleteRequest.java
    
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/GetRequest.java
    
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/PostRequest.java
    
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/PutRequest.java
Modified:
    
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
    
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java

Added: 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/DeleteRequest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/DeleteRequest.java?rev=1778946&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/DeleteRequest.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/DeleteRequest.java
 Sun Jan 15 21:15:53 2017
@@ -0,0 +1,63 @@
+/*
+ * 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 java.io.IOException;
+import java.net.URL;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.http.Request;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+class DeleteRequest implements Request {
+    private static final Log log = LogFactory.getLog(DeleteRequest.class);
+
+    private final HTTPSenderImpl sender;
+    private final String soapActiionString;
+    private final MessageContext msgContext;
+    private final URL url;
+
+    DeleteRequest(HTTPSenderImpl sender, String soapActiionString, 
MessageContext msgContext, URL url) {
+        this.sender = sender;
+        this.soapActiionString = soapActiionString;
+        this.msgContext = msgContext;
+        this.url = url;
+    }
+
+    @Override
+    public void execute() throws AxisFault {
+        DeleteMethod deleteMethod = new DeleteMethod();
+        HttpClient httpClient = sender.getHttpClient(msgContext);
+        sender.populateCommonProperties(msgContext, url, deleteMethod, 
httpClient, soapActiionString);
+
+        try {
+            sender.executeMethod(httpClient, msgContext, url, deleteMethod);
+            sender.handleResponse(msgContext, deleteMethod);
+        } catch (IOException e) {
+            log.info("Unable to sendViaDelete to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            sender.cleanup(msgContext, deleteMethod);
+        }
+    }
+}
\ No newline at end of file

Added: 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/GetRequest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/GetRequest.java?rev=1778946&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/GetRequest.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/GetRequest.java
 Sun Jan 15 21:15:53 2017
@@ -0,0 +1,74 @@
+/*
+ * 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 java.io.IOException;
+import java.net.URL;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.Request;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+class GetRequest implements Request {
+    private static final Log log = LogFactory.getLog(GetRequest.class);
+    
+    private final HTTPSenderImpl sender;
+    private final MessageContext msgContext;
+    private final String soapActiionString;
+    private final URL url;
+
+    GetRequest(HTTPSenderImpl sender, MessageContext msgContext, String 
soapActiionString, URL url) {
+        this.sender = sender;
+        this.msgContext = msgContext;
+        this.soapActiionString = soapActiionString;
+        this.url = url;
+    }
+
+    @Override
+    public void execute() throws AxisFault {
+        GetMethod getMethod = new GetMethod();
+        HttpClient httpClient = sender.getHttpClient(msgContext);
+        MessageFormatter messageFormatter = 
sender.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, sender.getFormat(), 
soapActiionString);
+
+        if (soapAction != null && !msgContext.isDoingREST()) {
+            getMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, 
soapAction);
+        }
+        try {
+            sender.executeMethod(httpClient, msgContext, url, getMethod);
+            sender.handleResponse(msgContext, getMethod);
+        } catch (IOException e) {
+            log.info("Unable to sendViaGet to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            sender.cleanup(msgContext, getMethod);
+        }
+    }
+}
\ No newline at end of file

Modified: 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java?rev=1778946&r1=1778945&r2=1778946&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
 Sun Jan 15 21:15:53 2017
@@ -34,6 +34,7 @@ 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;
@@ -54,11 +55,6 @@ import org.apache.commons.httpclient.Htt
 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;
@@ -81,6 +77,22 @@ public class HTTPSenderImpl extends HTTP
 
     private static final Log log = LogFactory.getLog(HTTPSenderImpl.class);
 
+    OMOutputFormat getFormat() {
+        return format;
+    }
+
+    boolean isChunked() {
+        return chunked;
+    }
+
+    boolean isAllowedRetry() {
+        return isAllowedRetry;
+    }
+
+    String getHttpVersion() {
+        return httpVersion;
+    }
+
     /**
      * Used to send a request via HTTP Get method
      * 
@@ -95,33 +107,7 @@ public class HTTPSenderImpl extends HTTP
      */
     protected Request prepareGet(final MessageContext msgContext, final URL 
url, final String soapActiionString)
             throws AxisFault {
-        return new Request() {
-            @Override
-            public void execute() 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 && !msgContext.isDoingREST()) {
-                    
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);
-                }
-            }
-        };
+        return new GetRequest(this, msgContext, soapActiionString, url);
     }
 
     protected void cleanup(MessageContext msgContext, Object httpMmethod) {
@@ -147,24 +133,7 @@ public class HTTPSenderImpl extends HTTP
      */
     protected Request prepareDelete(final MessageContext msgContext, final URL 
url, final String soapActiionString)
             throws AxisFault {
-        return new Request() {
-            @Override
-            public void execute() 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);
-                }
-            }
-        };
+        return new DeleteRequest(this, soapActiionString, msgContext, url);
     }
 
     /**
@@ -181,55 +150,7 @@ public class HTTPSenderImpl extends HTTP
      */
     protected Request preparePost(final MessageContext msgContext, final URL 
url, final String soapActionString)
             throws AxisFault {
-        return new Request() {
-            @Override
-            public void execute() 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);
-        
-                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 && !msgContext.isDoingREST()) {
-                    
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);
-                }
-            }
-        };
+        return new PostRequest(this, url, msgContext, soapActionString);
     }
 
     /**
@@ -246,51 +167,7 @@ public class HTTPSenderImpl extends HTTP
      */
     protected Request preparePut(final MessageContext msgContext, final URL 
url, final String soapActionString)
             throws AxisFault {
-        return new Request() {
-            @Override
-            public void execute() 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 && !msgContext.isDoingREST()) {
-                    
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);
-                }
-            }
-        };
+        return new PutRequest(this, soapActionString, msgContext, url);
     }
 
     /**

Added: 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/PostRequest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/PostRequest.java?rev=1778946&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/PostRequest.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/PostRequest.java
 Sun Jan 15 21:15:53 2017
@@ -0,0 +1,96 @@
+/*
+ * 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 java.io.IOException;
+import java.net.URL;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.Request;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+class PostRequest implements Request {
+    private static final Log log = LogFactory.getLog(PostRequest.class);
+
+    private final HTTPSenderImpl sender;
+    private final URL url;
+    private final MessageContext msgContext;
+    private final String soapActionString;
+
+    PostRequest(HTTPSenderImpl sender, URL url, MessageContext msgContext, 
String soapActionString) {
+        this.sender = sender;
+        this.url = url;
+        this.msgContext = msgContext;
+        this.soapActionString = soapActionString;
+    }
+
+    @Override
+    public void execute() throws AxisFault {
+        HttpClient httpClient = sender.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 = 
sender.populateCommonProperties(msgContext, url, postMethod,
+                httpClient, soapActionString);
+
+        postMethod.setRequestEntity(new 
AxisRequestEntityImpl(messageFormatter, msgContext, sender.getFormat(),
+                soapActionString, sender.isChunked(), 
sender.isAllowedRetry()));
+
+        if (!sender.getHttpVersion().equals(HTTPConstants.HEADER_PROTOCOL_10) 
&& sender.isChunked()) {
+            postMethod.setContentChunked(true);
+        }
+
+        String soapAction = messageFormatter.formatSOAPAction(msgContext, 
sender.getFormat(), soapActionString);
+
+        if (soapAction != null && !msgContext.isDoingREST()) {
+            postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, 
soapAction);
+        }
+
+        /*
+         * main excecution takes place..
+         */
+        try {
+            sender.executeMethod(httpClient, msgContext, url, postMethod);
+            sender.handleResponse(msgContext, postMethod);
+        } catch (IOException e) {
+            log.info("Unable to sendViaPost to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            sender.cleanup(msgContext, postMethod);
+        }
+    }
+}
\ No newline at end of file

Added: 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/PutRequest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/PutRequest.java?rev=1778946&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/PutRequest.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/PutRequest.java
 Sun Jan 15 21:15:53 2017
@@ -0,0 +1,92 @@
+/*
+ * 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 java.io.IOException;
+import java.net.URL;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.Request;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+class PutRequest implements Request {
+    private static final Log log = LogFactory.getLog(PutRequest.class);
+
+    private final HTTPSenderImpl sender;
+    private final String soapActionString;
+    private final MessageContext msgContext;
+    private final URL url;
+
+    PutRequest(HTTPSenderImpl sender, String soapActionString, MessageContext 
msgContext, URL url) {
+        this.sender = sender;
+        this.soapActionString = soapActionString;
+        this.msgContext = msgContext;
+        this.url = url;
+    }
+
+    @Override
+    public void execute() throws AxisFault {
+        HttpClient httpClient = sender.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 = 
sender.populateCommonProperties(msgContext, url, putMethod,
+                httpClient, soapActionString);
+
+        putMethod.setRequestEntity(new AxisRequestEntityImpl(messageFormatter, 
msgContext, sender.getFormat(),
+                soapActionString, sender.isChunked(), 
sender.isAllowedRetry()));
+
+        if (!sender.getHttpVersion().equals(HTTPConstants.HEADER_PROTOCOL_10) 
&& sender.isChunked()) {
+            putMethod.setContentChunked(true);
+        }
+
+        String soapAction = messageFormatter.formatSOAPAction(msgContext, 
sender.getFormat(), soapActionString);
+        if (soapAction != null && !msgContext.isDoingREST()) {
+            putMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, 
soapAction);
+        }
+
+        /*
+         * main excecution takes place..
+         */
+        try {
+            sender.executeMethod(httpClient, msgContext, url, putMethod);
+            sender.handleResponse(msgContext, putMethod);
+        } catch (IOException e) {
+            log.info("Unable to sendViaPut to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            sender.cleanup(msgContext, putMethod);
+        }
+    }
+}
\ No newline at end of file

Added: 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/DeleteRequest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/DeleteRequest.java?rev=1778946&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/DeleteRequest.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/DeleteRequest.java
 Sun Jan 15 21:15:53 2017
@@ -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 java.io.IOException;
+import java.net.URL;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.http.Request;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.impl.client.AbstractHttpClient;
+
+class DeleteRequest implements Request {
+    private static final Log log = LogFactory.getLog(DeleteRequest.class);
+
+    private final HTTPSenderImpl sender;
+    private final MessageContext msgContext;
+    private final URL url;
+    private final String soapActionString;
+
+    DeleteRequest(HTTPSenderImpl sender, MessageContext msgContext, URL url, 
String soapActionString) {
+        this.sender = sender;
+        this.msgContext = msgContext;
+        this.url = url;
+        this.soapActionString = soapActionString;
+    }
+
+    @Override
+    public void execute() throws AxisFault {
+        HttpDelete deleteMethod = new HttpDelete();
+        AbstractHttpClient httpClient = sender.getHttpClient(msgContext);
+        sender.populateCommonProperties(msgContext, url, deleteMethod, 
httpClient, soapActionString);
+
+        /*
+         * main execution takes place..
+         */
+        HttpResponse response = null;
+        try {
+            response = sender.executeMethod(httpClient, msgContext, url, 
deleteMethod);
+            sender.handleResponse(msgContext, response);
+        } catch (IOException e) {
+            log.info("Unable to sendViaDelete to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            sender.cleanup(msgContext, response);
+        }
+    }
+}
\ No newline at end of file

Added: 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/GetRequest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/GetRequest.java?rev=1778946&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/GetRequest.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/GetRequest.java
 Sun Jan 15 21:15:53 2017
@@ -0,0 +1,80 @@
+/*
+ * 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 java.io.IOException;
+import java.net.URL;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.Request;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.AbstractHttpClient;
+
+class GetRequest implements Request {
+    private static final Log log = LogFactory.getLog(GetRequest.class);
+
+    private final HTTPSenderImpl sender;
+    private final MessageContext msgContext;
+    private final String soapActionString;
+    private final URL url;
+
+    GetRequest(HTTPSenderImpl sender, MessageContext msgContext, String 
soapActionString, URL url) {
+        this.sender = sender;
+        this.msgContext = msgContext;
+        this.soapActionString = soapActionString;
+        this.url = url;
+    }
+
+    @Override
+    public void execute() throws AxisFault {
+        HttpGet httpGet = new HttpGet();
+        AbstractHttpClient httpClient = sender.getHttpClient(msgContext);
+        MessageFormatter messageFormatter = 
sender.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, sender.getFormat(), 
soapActionString);
+
+        if (soapAction != null && !msgContext.isDoingREST()) {
+            httpGet.setHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
+        }
+
+        /*
+         * main execution takes place..
+         */
+        HttpResponse response = null;
+        try {
+            response = sender.executeMethod(httpClient, msgContext, url, 
httpGet);
+            sender.handleResponse(msgContext, response);
+        } catch (IOException e) {
+            log.info("Unable to sendViaGet to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            sender.cleanup(msgContext, response);
+        }
+    }
+}
\ No newline at end of file

Modified: 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java?rev=1778946&r1=1778945&r2=1778946&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
 Sun Jan 15 21:15:53 2017
@@ -22,6 +22,7 @@ package org.apache.axis2.transport.http.
 
 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;
@@ -52,10 +53,6 @@ import org.apache.http.auth.Credentials;
 import org.apache.http.auth.NTCredentials;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.http.auth.params.AuthPNames;
-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;
@@ -96,6 +93,22 @@ public class HTTPSenderImpl extends HTTP
 
     private static final Log log = LogFactory.getLog(HTTPSenderImpl.class);
 
+    OMOutputFormat getFormat() {
+        return format;
+    }
+
+    boolean isChunked() {
+        return chunked;
+    }
+
+    boolean isAllowedRetry() {
+        return isAllowedRetry;
+    }
+
+    String getHttpVersion() {
+        return httpVersion;
+    }
+
     /**
      * Used to send a request via HTTP Get method
      *
@@ -106,38 +119,7 @@ public class HTTPSenderImpl extends HTTP
      */
     protected Request prepareGet(final MessageContext msgContext, final URL 
url, final String soapActionString)
             throws AxisFault {
-        return new Request() {
-            @Override
-            public void execute() 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 && !msgContext.isDoingREST()) {
-                    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);
-                }
-            }
-        };
+        return new GetRequest(this, msgContext, soapActionString, url);
     }
 
     @Override
@@ -172,28 +154,7 @@ public class HTTPSenderImpl extends HTTP
      */
     protected Request prepareDelete(final MessageContext msgContext, final URL 
url, final String soapActionString)
             throws AxisFault {
-        return new Request() {
-            @Override
-            public void execute() 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);
-                }
-            }
-        };
+        return new DeleteRequest(this, msgContext, url, soapActionString);
     }
 
     /**
@@ -206,57 +167,7 @@ public class HTTPSenderImpl extends HTTP
      */
     protected Request preparePost(final MessageContext msgContext, final URL 
url, final String soapActionString)
             throws AxisFault {
-        return new Request() {
-            @Override
-            public void execute() 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 && !msgContext.isDoingREST()) {
-                    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);
-                }
-            }
-        };
+        return new PostRequest(this, msgContext, url, soapActionString);
     }
 
     /**
@@ -269,53 +180,7 @@ public class HTTPSenderImpl extends HTTP
      */
     protected Request preparePut(final MessageContext msgContext, final URL 
url, final String soapActionString)
             throws AxisFault {
-        return new Request() {
-            @Override
-            public void execute() 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 && !msgContext.isDoingREST()) {
-                    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);
-                }
-            }
-        };
+        return new PutRequest(this, url, soapActionString, msgContext);
     }
 
     /**

Added: 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/PostRequest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/PostRequest.java?rev=1778946&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/PostRequest.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/PostRequest.java
 Sun Jan 15 21:15:53 2017
@@ -0,0 +1,99 @@
+/*
+ * 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 java.io.IOException;
+import java.net.URL;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.Request;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.AbstractHttpClient;
+
+class PostRequest implements Request {
+    private static final Log log = LogFactory.getLog(PostRequest.class);
+
+    private final HTTPSenderImpl sender;
+    private final MessageContext msgContext;
+    private final URL url;
+    private final String soapActionString;
+
+    PostRequest(HTTPSenderImpl sender, MessageContext msgContext, URL url, 
String soapActionString) {
+        this.sender = sender;
+        this.msgContext = msgContext;
+        this.url = url;
+        this.soapActionString = soapActionString;
+    }
+
+    @Override
+    public void execute() throws AxisFault {
+        AbstractHttpClient httpClient = sender.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 = 
sender.populateCommonProperties(msgContext, url, postMethod,
+                                                                     
httpClient, soapActionString);
+        AxisRequestEntityImpl requestEntity =
+                new AxisRequestEntityImpl(messageFormatter, msgContext, 
sender.getFormat(),
+                                          soapActionString, 
sender.isChunked(), sender.isAllowedRetry());
+        postMethod.setEntity(requestEntity);
+
+        if (!sender.getHttpVersion().equals(HTTPConstants.HEADER_PROTOCOL_10) 
&& sender.isChunked()) {
+            requestEntity.setChunked(sender.isChunked());
+        }
+
+        String soapAction = messageFormatter.formatSOAPAction(msgContext, 
sender.getFormat(), soapActionString);
+
+        if (soapAction != null && !msgContext.isDoingREST()) {
+            postMethod.setHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
+        }
+
+        /*
+         * main execution takes place..
+         */
+        HttpResponse response = null;
+        try {
+            response = sender.executeMethod(httpClient, msgContext, url, 
postMethod);
+            sender.handleResponse(msgContext, response);
+        } catch (IOException e) {
+            log.info("Unable to sendViaPost to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            sender.cleanup(msgContext, response);
+        }
+    }
+}
\ No newline at end of file

Added: 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/PutRequest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/PutRequest.java?rev=1778946&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/PutRequest.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/PutRequest.java
 Sun Jan 15 21:15:53 2017
@@ -0,0 +1,95 @@
+/*
+ * 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 java.io.IOException;
+import java.net.URL;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.Request;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.impl.client.AbstractHttpClient;
+
+class PutRequest implements Request {
+    private static final Log log = LogFactory.getLog(PutRequest.class);
+
+    private final HTTPSenderImpl sender;
+    private final URL url;
+    private final String soapActionString;
+    private final MessageContext msgContext;
+
+    PutRequest(HTTPSenderImpl sender, URL url, String soapActionString, 
MessageContext msgContext) {
+        this.sender = sender;
+        this.url = url;
+        this.soapActionString = soapActionString;
+        this.msgContext = msgContext;
+    }
+
+    @Override
+    public void execute() throws AxisFault {
+        AbstractHttpClient httpClient = sender.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 = 
sender.populateCommonProperties(msgContext, url, putMethod,
+                                                                     
httpClient, soapActionString);
+        AxisRequestEntityImpl requestEntity =
+                new AxisRequestEntityImpl(messageFormatter, msgContext, 
sender.getFormat(),
+                                          soapActionString, 
sender.isChunked(), sender.isAllowedRetry());
+        putMethod.setEntity(requestEntity);
+
+        if (!sender.getHttpVersion().equals(HTTPConstants.HEADER_PROTOCOL_10) 
&& sender.isChunked()) {
+            requestEntity.setChunked(sender.isChunked());
+        }
+
+        String soapAction = messageFormatter.formatSOAPAction(msgContext, 
sender.getFormat(), soapActionString);
+        if (soapAction != null && !msgContext.isDoingREST()) {
+            putMethod.setHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
+        }
+
+        /*
+         * main execution takes place..
+         */
+        HttpResponse response = null;
+        try {
+            response = sender.executeMethod(httpClient, msgContext, url, 
putMethod);
+            sender.handleResponse(msgContext, response);
+        } catch (IOException e) {
+            log.info("Unable to sendViaPut to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            sender.cleanup(msgContext, response);
+        }
+    }
+}
\ No newline at end of file


Reply via email to