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 2007/01/03 03:29:35 UTC
svn commit: r492018 - in
/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2:
context/ConfigurationContext.java engine/InstanceDispatcher.java
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