Author: gawor
Date: Wed Apr  1 20:24:56 2009
New Revision: 761045

URL: http://svn.apache.org/viewvc?rev=761045&view=rev
Log:
Step 2 in moving http and local transport modules to Axis2. Made http and local 
transport modules independent of the base module.

Removed:
    
webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/QueryStringParser.java
    
webservices/commons/trunk/modules/transport/modules/base/src/test/java/org/apache/axis2/transport/base/QueryStringParserTest.java
Modified:
    
webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/BaseUtils.java
    webservices/commons/trunk/modules/transport/modules/http/pom.xml
    
webservices/commons/trunk/modules/transport/modules/http/src/org/apache/axis2/transport/http/AxisServlet.java
    
webservices/commons/trunk/modules/transport/modules/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
    webservices/commons/trunk/modules/transport/modules/local/pom.xml
    
webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalResponder.java
    
webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalTransportSender.java
    
webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPTransportSender.java

Modified: 
webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/BaseUtils.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/BaseUtils.java?rev=761045&r1=761044&r2=761045&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/BaseUtils.java
 (original)
+++ 
webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/BaseUtils.java
 Wed Apr  1 20:24:56 2009
@@ -121,14 +121,14 @@
     public static OMOutputFormat getOMOutputFormat(MessageContext msgContext) {
 
         OMOutputFormat format = new OMOutputFormat();
-        msgContext.setDoingMTOM(doWriteMTOM(msgContext));
-        msgContext.setDoingSwA(doWriteSwA(msgContext));
-        msgContext.setDoingREST(isDoingREST(msgContext));
+        msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext));
+        msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext));
+        msgContext.setDoingREST(TransportUtils.isDoingREST(msgContext));
         format.setSOAP11(msgContext.isSOAP11());
         format.setDoOptimize(msgContext.isDoingMTOM());
         format.setDoingSWA(msgContext.isDoingSwA());
 
-        format.setCharSetEncoding(getCharSetEncoding(msgContext));
+        
format.setCharSetEncoding(TransportUtils.getCharSetEncoding(msgContext));
         Object mimeBoundaryProperty = 
msgContext.getProperty(Constants.Configuration.MIME_BOUNDARY);
         if (mimeBoundaryProperty != null) {
             format.setMimeBoundary((String) mimeBoundaryProperty);
@@ -207,140 +207,6 @@
     }
 
     /**
-     * <p>
-     * Checks whether MTOM needs to be enabled for the message represented by
-     * the msgContext. We check value assigned to the "enableMTOM" property
-     * either using the config files (axis2.xml, services.xml) or
-     * programatically. Programatic configuration is given priority. If the
-     * given value is "optional", MTOM will be enabled only if the incoming
-     * message was an MTOM message.
-     * </p>
-     *
-     * @param msgContext the active MessageContext
-     * @return true if SwA needs to be enabled
-     */
-    public static boolean doWriteMTOM(MessageContext msgContext) {
-        boolean enableMTOM;
-        Object enableMTOMObject = null;
-        // First check the whether MTOM is enabled by the configuration
-        // (Eg:Axis2.xml, services.xml)
-        Parameter parameter = 
msgContext.getParameter(Constants.Configuration.ENABLE_MTOM);
-        if (parameter != null) {
-            enableMTOMObject = parameter.getValue();
-        }
-        // Check whether the configuration is overridden programatically..
-        // Priority given to programatically setting of the value
-        Object property = 
msgContext.getProperty(Constants.Configuration.ENABLE_MTOM);
-        if (property != null) {
-            enableMTOMObject = property;
-        }
-        enableMTOM = JavaUtils.isTrueExplicitly(enableMTOMObject);
-        // Handle the optional value for enableMTOM
-        // If the value for 'enableMTOM' is given as optional and if the 
request
-        // message was a MTOM message we sent out MTOM
-        if (!enableMTOM && msgContext.isDoingMTOM() && (enableMTOMObject 
instanceof String)) {
-            if (((String) 
enableMTOMObject).equalsIgnoreCase(Constants.VALUE_OPTIONAL)) {
-                //In server side, we check whether request was MTOM
-                if (msgContext.isServerSide()) {
-                    if (msgContext.isDoingMTOM()) {
-                        enableMTOM = true;
-                    } 
-                // in the client side, we enable MTOM if it is optional    
-                } else {
-                    enableMTOM = true;
-                }
-            }
-        }
-        return enableMTOM;
-    }
-
-    /**
-     * <p>
-     * Checks whether SOAP With Attachments (SwA) needs to be enabled for the
-     * message represented by the msgContext. We check value assigned to the
-     * "enableSwA" property either using the config files (axis2.xml,
-     * services.xml) or programatically. Programatic configuration is given
-     * priority. If the given value is "optional", SwA will be enabled only if
-     * the incoming message was SwA type.
-     * </p>
-     *
-     * @param msgContext the active MessageContext
-     * @return true if SwA needs to be enabled
-     */
-    public static boolean doWriteSwA(MessageContext msgContext) {
-        boolean enableSwA;
-        Object enableSwAObject = null;
-        // First check the whether SwA is enabled by the configuration
-        // (Eg:Axis2.xml, services.xml)
-        Parameter parameter = 
msgContext.getParameter(Constants.Configuration.ENABLE_SWA);
-        if (parameter != null) {
-            enableSwAObject = parameter.getValue();
-        }
-        // Check whether the configuration is overridden programatically..
-        // Priority given to programatically setting of the value
-        Object property = 
msgContext.getProperty(Constants.Configuration.ENABLE_SWA);
-        if (property != null) {
-            enableSwAObject = property;
-        }
-        enableSwA = JavaUtils.isTrueExplicitly(enableSwAObject);
-        // Handle the optional value for enableSwA
-        // If the value for 'enableSwA' is given as optional and if the request
-        // message was a SwA message we sent out SwA
-        if (!enableSwA && msgContext.isDoingSwA() && (enableSwAObject 
instanceof String)) {
-            if (((String) 
enableSwAObject).equalsIgnoreCase(Constants.VALUE_OPTIONAL)) {
-                enableSwA = true;
-            }
-        }
-        return enableSwA;
-    }
-
-    /**
-     * Utility method to query CharSetEncoding. First look in the
-     * MessageContext. If it's not there look in the OpContext. Use the 
defualt,
-     * if it's not given in either contexts.
-     *
-     * @param msgContext the active MessageContext
-     * @return String the CharSetEncoding
-     */
-    public static String getCharSetEncoding(MessageContext msgContext) {
-        String charSetEnc = (String) msgContext
-                .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
-
-        if (charSetEnc == null) {
-            OperationContext opctx = msgContext.getOperationContext();
-            if (opctx != null) {
-                charSetEnc = (String) opctx
-                        
.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
-            }
-            /**
-             * If the char set enc is still not found use the default
-             */
-            if (charSetEnc == null) {
-                charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
-            }
-        }
-        return charSetEnc;
-    }
-
-    public static boolean isDoingREST(MessageContext msgContext) {
-        boolean enableREST = false;
-
-        // check whether isDoingRest is already true in the message context
-        if (msgContext.isDoingREST()) {
-            return true;
-        }
-
-        Object enableRESTProperty = 
msgContext.getProperty(Constants.Configuration.ENABLE_REST);
-        if (enableRESTProperty != null) {
-            enableREST = JavaUtils.isTrueExplicitly(enableRESTProperty);
-        }
-
-        msgContext.setDoingREST(enableREST);
-
-        return enableREST;
-    }
-
-    /**
      * Extract the properties from an endpoint reference.
      *
      * @param url an endpoint reference

Modified: webservices/commons/trunk/modules/transport/modules/http/pom.xml
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/http/pom.xml?rev=761045&r1=761044&r2=761045&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/http/pom.xml (original)
+++ webservices/commons/trunk/modules/transport/modules/http/pom.xml Wed Apr  1 
20:24:56 2009
@@ -108,19 +108,14 @@
             <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
         </dependency>
+
         <dependency>
             <groupId>org.apache.axis2</groupId>
-            <artifactId>axis2-transport-base</artifactId>
-            <version>${version}</version>
+            <artifactId>axis2-transport-testkit</artifactId>
+            <version>${pom.version}</version>
+            <scope>test</scope>
         </dependency>
 
-      <dependency>
-          <groupId>org.apache.axis2</groupId>
-          <artifactId>axis2-transport-testkit</artifactId>
-          <version>${pom.version}</version>
-          <scope>test</scope>
-      </dependency>
-
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>

Modified: 
webservices/commons/trunk/modules/transport/modules/http/src/org/apache/axis2/transport/http/AxisServlet.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/http/src/org/apache/axis2/transport/http/AxisServlet.java?rev=761045&r1=761044&r2=761045&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/transport/modules/http/src/org/apache/axis2/transport/http/AxisServlet.java
 (original)
+++ 
webservices/commons/trunk/modules/transport/modules/http/src/org/apache/axis2/transport/http/AxisServlet.java
 Wed Apr  1 20:24:56 2009
@@ -47,8 +47,8 @@
 import org.apache.axis2.transport.RequestResponseTransport;
 import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.transport.base.QueryStringParser;
 import org.apache.axis2.transport.http.server.HttpUtils;
+import org.apache.axis2.transport.http.util.QueryStringParser;
 import org.apache.axis2.transport.http.util.RESTUtil;
 import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.util.MessageContextBuilder;

Modified: 
webservices/commons/trunk/modules/transport/modules/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=761045&r1=761044&r2=761045&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/transport/modules/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
 (original)
+++ 
webservices/commons/trunk/modules/transport/modules/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
 Wed Apr  1 20:24:56 2009
@@ -32,7 +32,6 @@
 import org.apache.axis2.transport.OutTransportInfo;
 import org.apache.axis2.transport.TransportSender;
 import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.transport.base.BaseUtils;
 import org.apache.axis2.transport.http.server.AxisHttpResponseImpl;
 import org.apache.axis2.util.JavaUtils;
 import org.apache.commons.httpclient.Header;
@@ -146,14 +145,13 @@
         try {
             OMOutputFormat format = new OMOutputFormat();
             // if (!msgContext.isDoingMTOM())
-            msgContext.setDoingMTOM(BaseUtils.doWriteMTOM(msgContext));
-            msgContext.setDoingSwA(BaseUtils.doWriteSwA(msgContext));
-            msgContext.setDoingREST(BaseUtils.isDoingREST(msgContext));
+            msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext));
+            msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext));
+            msgContext.setDoingREST(TransportUtils.isDoingREST(msgContext));
             format.setSOAP11(msgContext.isSOAP11());
             format.setDoOptimize(msgContext.isDoingMTOM());
             format.setDoingSWA(msgContext.isDoingSwA());
-            format.setCharSetEncoding(BaseUtils
-                .getCharSetEncoding(msgContext));
+            
format.setCharSetEncoding(TransportUtils.getCharSetEncoding(msgContext));
 
             Object mimeBoundaryProperty = msgContext
                     .getProperty(Constants.Configuration.MIME_BOUNDARY);

Modified: webservices/commons/trunk/modules/transport/modules/local/pom.xml
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/local/pom.xml?rev=761045&r1=761044&r2=761045&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/local/pom.xml (original)
+++ webservices/commons/trunk/modules/transport/modules/local/pom.xml Wed Apr  
1 20:24:56 2009
@@ -75,11 +75,6 @@
 
     <dependencies>
         <dependency>
-            <groupId>org.apache.axis2</groupId>
-            <artifactId>axis2-transport-base</artifactId>
-            <version>${version}</version>
-        </dependency>
-        <dependency>
             <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
         </dependency>

Modified: 
webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalResponder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalResponder.java?rev=761045&r1=761044&r2=761045&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalResponder.java
 (original)
+++ 
webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalResponder.java
 Wed Apr  1 20:24:56 2009
@@ -28,7 +28,6 @@
 import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.axis2.transport.TransportSender;
 import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.transport.base.BaseUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -69,8 +68,8 @@
 
         // Check for the REST behaviour, if you desire rest beahaviour
         // put a <parameter name="doREST" value="true"/> at the axis2.xml
-        msgContext.setDoingMTOM(BaseUtils.doWriteMTOM(msgContext));
-        msgContext.setDoingSwA(BaseUtils.doWriteSwA(msgContext));
+        msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext));
+        msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext));
 
         EndpointReference epr = null;
 

Modified: 
webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalTransportSender.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalTransportSender.java?rev=761045&r1=761044&r2=761045&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalTransportSender.java
 (original)
+++ 
webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalTransportSender.java
 Wed Apr  1 20:24:56 2009
@@ -28,7 +28,6 @@
 import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.axis2.transport.TransportSender;
 import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.transport.base.BaseUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -61,8 +60,8 @@
 
         // Check for the REST behaviour, if you desire rest beahaviour
         // put a <parameter name="doREST" value="true"/> at the axis2.xml
-        msgContext.setDoingMTOM(BaseUtils.doWriteMTOM(msgContext));
-        msgContext.setDoingSwA(BaseUtils.doWriteSwA(msgContext));
+        msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext));
+        msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext));
 
         OutputStream out;
         EndpointReference epr = msgContext.getTo();

Modified: 
webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPTransportSender.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPTransportSender.java?rev=761045&r1=761044&r2=761045&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPTransportSender.java
 (original)
+++ 
webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPTransportSender.java
 Wed Apr  1 20:24:56 2009
@@ -29,7 +29,6 @@
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.TransportSender;
 import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.transport.base.BaseUtils;
 import org.apache.axis2.util.URL;
 
 import java.io.IOException;
@@ -72,8 +71,8 @@
 
         // Check for the REST behaviour, if you desire rest beahaviour
         // put a <parameter name="doREST" value="true"/> at the axis2.xml
-        msgContext.setDoingMTOM(BaseUtils.doWriteMTOM(msgContext));
-        msgContext.setDoingSwA(BaseUtils.doWriteSwA(msgContext));
+        msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext));
+        msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext));
 
         OutputStream out;
         EndpointReference epr = null;


Reply via email to