ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r492018 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: context/ConfigurationContext.java engine/InstanceDispatcher.java
Date Wed, 03 Jan 2007 02:29:35 GMT
Author: dims
Date: Tue Jan  2 18:29:34 2007
New Revision: 492018

URL: http://svn.apache.org/viewvc?view=rev&rev=492018
Log:
port 491887 - cache the getServiceContextPath, optimize the path for application scope by
avoiding calculation of maxscope

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/InstanceDispatcher.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java?view=diff&rev=492018&r1=492017&r2=492018
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
Tue Jan  2 18:29:34 2007
@@ -63,7 +63,8 @@
     private String contextRoot = "axis2";
     private String servicePath = "services";
     private String restPath = Constants.DEFAULT_REST_PATH;
-    //To have your own context path
+
+    private String cachedServicePath = null;
 
     public ConfigurationContext(AxisConfiguration axisConfiguration) {
         super(null);
@@ -156,25 +157,32 @@
                 }
             }
 
-            /**
-             * 1. Check the max scope of the service group , if it is grater than TransportSession
-             *    then need to store in configurationContext
-             * 2. Else need to store in SessionContext , and need to store both service context
and
-             *    service group context
-             */
-            String maxScope = SessionUtils.calculateMaxScopeForServiceGroup(serviceGroupContext.getDescription());
-            if (Constants.SCOPE_SOAP_SESSION.equals(maxScope)) {
-                registerServiceGroupContext(serviceGroupContext);
-            } else if (Constants.SCOPE_TRANSPORT_SESSION.equals(maxScope)) {
-                if (sessionContext != null) {
-                    sessionContext.addServiceGroupContext(serviceGroupContext, serviceGroupContextId);
-                    sessionContext.addServiceContext(serviceContext);
+            // If the current axis service's scope is application. Then, whatever be the
scope for
+            // the other services, the maxScope will be application. So no need to calculate
the maxscope.
+            if (!Constants.SCOPE_APPLICATION.equals(axisService.getScope())) {
+                /**
+                 * 1. Check the max scope of the service group , if it is grater than TransportSession
+                 *    then need to store in configurationContext
+                 * 2. Else need to store in SessionContext , and need to store both service
context and
+                 *    service group context
+                 */
+                String maxScope = SessionUtils.calculateMaxScopeForServiceGroup(serviceGroupContext.getDescription());
+                if (Constants.SCOPE_SOAP_SESSION.equals(maxScope)) {
+                    registerServiceGroupContext(serviceGroupContext);
+                } else if (Constants.SCOPE_TRANSPORT_SESSION.equals(maxScope)) {
+                    if (sessionContext != null) {
+                        sessionContext.addServiceGroupContext(serviceGroupContext, serviceGroupContextId);
+                        sessionContext.addServiceContext(serviceContext);
+                    }
+                }
+                messageContext.setServiceContext(serviceContext);
+                if (Constants.SCOPE_REQUEST.equals(maxScope)) {
+                    messageContext.setServiceGroupContextId(null);
+                } else {
+                    messageContext.setServiceGroupContext(serviceGroupContext);
                 }
-            }
-            messageContext.setServiceContext(serviceContext);
-            if (Constants.SCOPE_REQUEST.equals(maxScope)) {
-                messageContext.setServiceGroupContextId(null);
             } else {
+                messageContext.setServiceContext(serviceContext);
                 messageContext.setServiceGroupContext(serviceGroupContext);
             }
         }
@@ -376,6 +384,13 @@
     }
 
     public String getServiceContextPath() {
+        if(cachedServicePath == null){
+            cachedServicePath = internalGetServiceContextPath();
+        }
+        return cachedServicePath;
+    }
+    
+    private String internalGetServiceContextPath() {
         String ctxRoot = getContextRoot().trim();
         String path = "/";
         if (!ctxRoot.equals("/")) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/InstanceDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/InstanceDispatcher.java?view=diff&rev=492018&r1=492017&r2=492018
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/InstanceDispatcher.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/InstanceDispatcher.java
Tue Jan  2 18:29:34 2007
@@ -48,6 +48,7 @@
      * @throws org.apache.axis2.AxisFault
      */
     public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+        String scope = msgContext.getAxisService().getScope();
         ServiceContext serviceContext = msgContext.getServiceContext();
 
         if ((msgContext.getOperationContext() != null)
@@ -58,11 +59,13 @@
             return InvocationResponse.CONTINUE;        
         }
 
-        // try to extract sgcId from the message
-        extractServiceGroupContextId(msgContext);
+        if(!Constants.SCOPE_APPLICATION.equals(scope)) {
+            // try to extract sgcId from the message
+            extractServiceGroupContextId(msgContext);
 
-        //trying to get service context from Session context
-        fillContextsFromSessionContext(msgContext);
+            //trying to get service context from Session context
+            fillContextsFromSessionContext(msgContext);
+        }
 
         AxisOperation axisOperation = msgContext.getAxisOperation();
 



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


Mime
View raw message