axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r761202 - in /webservices/axis2/branches/java/1_5: ./ modules/kernel/src/org/apache/axis2/transport/ modules/kernel/src/org/apache/axis2/transport/http/util/ modules/kernel/test/org/apache/axis2/transport/http/util/
Date Thu, 02 Apr 2009 08:29:33 GMT
Author: veithen
Date: Thu Apr  2 08:29:32 2009
New Revision: 761202

URL: http://svn.apache.org/viewvc?rev=761202&view=rev
Log:
Merged Jarek's transport related changes (move of HTTP and local) to the 1.5 branch so that
we can get the Synapse transports up and running again.

Added:
    webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/transport/http/util/QueryStringParser.java
      - copied unchanged from r761044, webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/QueryStringParser.java
    webservices/axis2/branches/java/1_5/modules/kernel/test/org/apache/axis2/transport/http/util/QueryStringParserTest.java
      - copied unchanged from r761044, webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/http/util/QueryStringParserTest.java
Modified:
    webservices/axis2/branches/java/1_5/   (props changed)
    webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java

Propchange: webservices/axis2/branches/java/1_5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr  2 08:29:32 2009
@@ -1 +1 @@
-/webservices/axis2/trunk/java:732924,732927,732939,733776,741873,748761,754467,754503,757151-757153,759488,759507,759878,759968,761025
+/webservices/axis2/trunk/java:732924,732927,732939,733776,741873,748761,754467,754503,757151-757153,759488,759507,759878,759968,761025,761044

Modified: webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java?rev=761202&r1=761201&r2=761202&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
(original)
+++ webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
Thu Apr  2 08:29:32 2009
@@ -38,6 +38,7 @@
 import org.apache.axis2.builder.Builder;
 import org.apache.axis2.builder.BuilderUtil;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.deployment.DeploymentConstants;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.i18n.Messages;
@@ -597,4 +598,139 @@
                throw AxisFault.makeFault(t);
            }
        }
+
+    /**
+     * <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;
+    }
+
+    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;
+    }
+
+    /**
+     * 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;
+    }
+
 }



Mime
View raw message