axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r355859 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http: AbstractHTTPSender.java AbstractSender.java CommonsHTTPTransportSender.java RESTSender.java SOAPOverHTTPSender.java SOAPSender.java
Date Sun, 11 Dec 2005 01:52:36 GMT
Author: chinthaka
Date: Sat Dec 10 17:52:34 2005
New Revision: 355859

URL: http://svn.apache.org/viewcvs?rev=355859&view=rev
Log:
More refactoring on AbstractSender and its derivations.

Added:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
      - copied, changed from r355854, webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractSender.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
      - copied, changed from r355854, webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPSender.java
Removed:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractSender.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPSender.java
Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.java

Copied: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
(from r355854, webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractSender.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?p2=webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java&p1=webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractSender.java&r1=355854&r2=355859&rev=355859&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractSender.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
Sat Dec 10 17:52:34 2005
@@ -6,18 +6,6 @@
  */
 package org.apache.axis2.transport.http;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLStreamException;
-
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
@@ -28,22 +16,25 @@
 import org.apache.axis2.om.OMAttribute;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMOutputFormat;
-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.HttpMethodBase;
-import org.apache.commons.httpclient.NTCredentials;
-import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.*;
 import org.apache.commons.httpclient.auth.AuthScope;
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import javax.xml.namespace.QName;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLStreamException;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Iterator;
+
 
-public abstract class AbstractSender {
+public abstract class AbstractHTTPSender {
 	protected boolean chuncked = false;
 
 	protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
@@ -73,8 +64,8 @@
         this.format = format;
     }
 
-    public abstract void transportConfiguration(MessageContext msgContext,
-			OMElement dataout, URL url, String soapActionString)
+    public abstract void send(MessageContext msgContext,
+                              OMElement dataout, URL url, String soapActionString)
 			throws MalformedURLException, AxisFault, IOException;
 
 	/**

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=355859&r1=355858&r2=355859&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
Sat Dec 10 17:52:34 2005
@@ -30,8 +30,8 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMOutputFormat;
 import org.apache.axis2.om.impl.OMNodeEx;
-import org.apache.axis2.transport.TransportSender;
 import org.apache.axis2.transport.OutTransportInfo;
+import org.apache.axis2.transport.TransportSender;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.HttpMethod;
@@ -40,7 +40,6 @@
 
 import javax.xml.stream.FactoryConfigurationError;
 import javax.xml.stream.XMLStreamException;
-
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.MalformedURLException;
@@ -195,15 +194,15 @@
             }
 
             //select the Message Sender depending on the REST status
-            AbstractSender sender = null;
+            AbstractHTTPSender sender = null;
             if (!msgContext.isDoingREST()) {
-                sender = new SOAPSender();
+                sender = new SOAPOverHTTPSender();
             } else {
                 sender = new RESTSender();
             }
 
             sender.setFormat(this.format);
-            sender.transportConfiguration(msgContext, dataout, url,
+            sender.send(msgContext, dataout, url,
                     soapActionString);
 
         } catch (MalformedURLException e) {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.java?rev=355859&r1=355858&r2=355859&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.java
Sat Dec 10 17:52:34 2005
@@ -33,7 +33,7 @@
 import java.util.Iterator;
 
 
-public class RESTSender extends AbstractSender {
+public class RESTSender extends AbstractHTTPSender {
 
     private Log log = LogFactory.getLog(getClass());
 
@@ -42,23 +42,22 @@
      * By this time, you must have identified that you are doing REST here. Following default
values
      * will apply.
      * If the HTTPMethod is not set, I prefer to set it as POST by default.
-     * If the HTTPMethod is POST, default content type will always be text/plain.
      *
      * @param msgContext
      * @param dataout
      * @param url
      * @param soapActionString
      */
-    public void transportConfiguration(MessageContext msgContext,
-                                       OMElement dataout, URL url, String soapActionString)
{
+    public void send(MessageContext msgContext,
+                     OMElement dataout, URL url, String soapActionString) {
         try {
             String httpMethod = (String) msgContext.getProperty(Constants.Configuration.HTTP_METHOD);
 
             if (httpMethod != null && Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod))
{
-                this.transportConfigurationGET(msgContext, url);
+                this.sendViaGet(msgContext, url);
                 return;
             }
-            this.transportConfigurationPOST(msgContext, dataout, url,
+            this.sendViaPost(msgContext, dataout, url,
                     soapActionString);
 
         } catch (Exception e) {
@@ -66,8 +65,8 @@
         }
     }
 
-    public void transportConfigurationPOST(MessageContext msgContext,
-                                           OMElement dataout, URL url, String soapActionString)
{
+    private void sendViaPost(MessageContext msgContext,
+                             OMElement dataout, URL url, String soapActionString) {
         //execuite the HtttpMethodBase - a connection manager can be given for
         // handle multiple
         httpClient = new HttpClient();
@@ -187,7 +186,7 @@
         }
     }
 
-    private void transportConfigurationGET(MessageContext msgContext, URL url)
+    private void sendViaGet(MessageContext msgContext, URL url)
             throws MalformedURLException, AxisFault, IOException {
 
         String param = getParam(msgContext);

Copied: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
(from r355854, webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPSender.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java?p2=webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java&p1=webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPSender.java&r1=355854&r2=355859&rev=355859&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPSender.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
Sat Dec 10 17:52:34 2005
@@ -6,15 +6,6 @@
  */
 package org.apache.axis2.transport.http;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLStreamException;
-
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.i18n.Messages;
@@ -30,11 +21,19 @@
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.RequestEntity;
 
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLStreamException;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
 
-public class SOAPSender extends AbstractSender {
+public class SOAPOverHTTPSender extends AbstractHTTPSender {
 
-    public void transportConfiguration(MessageContext msgContext,
-                                       OMElement dataout, URL url, String soapActionString)
+    public void send(MessageContext msgContext,
+                     OMElement dataout, URL url, String soapActionString)
             throws MalformedURLException, AxisFault, IOException {
 
         // execute the HtttpMethodBase - a connection manager can be given for



Mime
View raw message