You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2006/11/24 20:09:22 UTC

svn commit: r478946 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: engine/Phase.java transport/TransportUtils.java transport/http/HTTPTransportUtils.java

Author: dims
Date: Fri Nov 24 11:09:20 2006
New Revision: 478946

URL: http://svn.apache.org/viewvc?view=rev&rev=478946
Log:
yet another Fix for AXIS2-1769 for performance

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/Phase.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/Phase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/Phase.java?view=diff&rev=478946&r1=478945&r2=478946
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/Phase.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/Phase.java Fri Nov 24 11:09:20 2006
@@ -90,6 +90,8 @@
         this(null);
     }
 
+    public static boolean isDebugEnabled = log.isDebugEnabled();
+    
     /**
      * Constructor Phase.
      *
@@ -355,7 +357,6 @@
      * @throws org.apache.axis2.AxisFault
      */
     public final InvocationResponse invoke(MessageContext msgctx) throws AxisFault {
-        boolean isDebugEnabled = log.isDebugEnabled();
         if (isDebugEnabled) {
             log.debug("Checking pre-condition for Phase \"" + phaseName + "\"");
         }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java?view=diff&rev=478946&r1=478945&r2=478946
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java Fri Nov 24 11:09:20 2006
@@ -157,10 +157,8 @@
         }
 
         // There might be "" around the value - if so remove them
-        value = value.replaceAll("\"", "");
-
-        if ("null".equalsIgnoreCase(value)) {
-            return null;
+        if(value.indexOf('\"')!=-1){
+            value = value.replaceAll("\"", "");
         }
 
         return value.trim();

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java?view=diff&rev=478946&r1=478945&r2=478946
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java Fri Nov 24 11:09:20 2006
@@ -156,10 +156,15 @@
         }
     }
 
+    private static final int VERSION_UNKNOWN = 0;
+    private static final int VERSION_SOAP11 = 1;
+    private static final int VERSION_SOAP12 = 2;
+
     public static void processHTTPPostRequest(MessageContext msgContext, InputStream in,
                                               OutputStream out, String contentType, String soapActionHeader, String requestURI)
             throws AxisFault {
-        boolean soap11 = false;
+
+        int soapVersion = VERSION_UNKNOWN;
 
         try {
 
@@ -173,7 +178,7 @@
             }
 
             // remove the starting and trailing " from the SOAP Action
-            if ((soapActionHeader != null) && soapActionHeader.startsWith("\"")
+            if ((soapActionHeader != null) && soapActionHeader.charAt(0) == '\"'
                 && soapActionHeader.endsWith("\"")) {
                 soapActionHeader = soapActionHeader.substring(1, soapActionHeader.length() - 1);
             }
@@ -188,7 +193,13 @@
             StAXBuilder builder = null;
 
             if (contentType != null) {
-                if (contentType.toLowerCase().indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) > -1) {
+
+                if (contentType.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) {
+                    soapVersion = VERSION_SOAP12;
+                } else if (contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
+                    soapVersion = VERSION_SOAP11;
+                }
+                if (soapVersion == VERSION_UNKNOWN && contentType.toLowerCase().indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) > -1) {
                     // It is MIME (MTOM or SwA)
                     builder = TransportUtils.selectBuilderForMIME(msgContext, in, contentType,true);
                     envelope = (SOAPEnvelope) builder.getDocumentElement();
@@ -217,9 +228,7 @@
                         msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
                     }
 
-                    if (contentType.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) {
-                        soap11 = false;
-
+                    if (soapVersion == VERSION_SOAP12) {
                         //Check for action header and set it in as soapAction in MessageContext
                         int index = contentType.indexOf("action");
                         if (index > -1) {
@@ -246,9 +255,7 @@
                                 new StAXSOAPModelBuilder(xmlreader,
                                                          SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
                         envelope = (SOAPEnvelope) builder.getDocumentElement();
-                    } else if (contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
-                        soap11 = true;
-
+                    } else if (soapVersion == VERSION_SOAP11) {
                         /**
                          * Configuration via Deployment
                          */
@@ -331,7 +338,7 @@
         } catch (FactoryConfigurationError e) {
             throw new AxisFault(e);
         } finally {
-            if ((msgContext.getEnvelope() == null) && !soap11) {
+            if ((msgContext.getEnvelope() == null) && soapVersion != VERSION_SOAP11) {
                 msgContext.setEnvelope(new SOAP12Factory().getDefaultEnvelope());
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org