Author: sagara
Date: Mon Feb  6 14:56:00 2012
New Revision: 1241031

URL: http://svn.apache.org/viewvc?rev=1241031&view=rev
Log:
Applied the patch for AXIS2-5058.

Modified:
    
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/HTTPWorker.java

Modified: 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/HTTPWorker.java?rev=1241031&r1=1241030&r2=1241031&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/HTTPWorker.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/HTTPWorker.java
 Mon Feb  6 14:56:00 2012
@@ -116,7 +116,12 @@ public class HTTPWorker implements Worke
                 }
             }
             if (HttpUtils.endsWithIgnoreCase(uri , "?wsdl2")) {
-                String serviceName = uri.substring(uri.lastIndexOf("/") + 1, 
uri.length() - 6);
+                /**
+                 * service name can be hierarchical 
(axis2/services/foo/1.0.0/Version?wsdl2) or
+                 * normal (axis2/services/Version?wsdl2).
+                 */
+                String[] temp = uri.split(contextPath);
+                String serviceName = temp[1].substring(0, temp[1].length() - 
6);
                 HashMap services = 
configurationContext.getAxisConfiguration().getServices();
                 AxisService service = (AxisService) services.get(serviceName);
                 if (service != null) {
@@ -136,7 +141,7 @@ public class HTTPWorker implements Worke
                  * service name can be hierarchical 
(axis2/services/foo/1.0.0/Version?wsdl) or
                  * normal (axis2/services/Version?wsdl).
                  */
-                String[] temp = 
uri.split(configurationContext.getServiceContextPath() + "/");
+                String[] temp = uri.split(contextPath);
                 String serviceName = temp[1].substring(0, temp[1].length() - 
5);
                 
                 HashMap services = 
configurationContext.getAxisConfiguration().getServices();
@@ -154,7 +159,12 @@ public class HTTPWorker implements Worke
                 }
             }
             if (HttpUtils.endsWithIgnoreCase(uri , "?xsd")) {
-                String serviceName = uri.substring(uri.lastIndexOf("/") + 1, 
uri.length() - 4);
+                /**
+                 * service name can be hierarchical 
(axis2/services/foo/bar/Version) or
+                 * normal (axis2/services/Version).
+                 */
+                String[] temp = uri.split(contextPath);
+                String serviceName = temp[1].substring(0, temp[1].length() - 
4);
                 HashMap services = 
configurationContext.getAxisConfiguration().getServices();
                 AxisService service = (AxisService) services.get(serviceName);
                 if (service != null) {
@@ -173,8 +183,9 @@ public class HTTPWorker implements Worke
             if (HttpUtils.indexOfIngnoreCase(uri , "?xsd=") > 0) {
                // fix for imported schemas
                String[] uriParts = uri.split("[?]xsd=");
-                String serviceName =
-                        uri.substring(uriParts[0].lastIndexOf("/") + 1, 
uriParts[0].length());
+                // fix for hierarchical service names
+                String[] temp = uriParts[0].split(contextPath);
+                String serviceName = temp[1];
                 String schemaName = uri.substring(uri.lastIndexOf("=") + 1);
 
                 HashMap services = 
configurationContext.getAxisConfiguration().getServices();


Reply via email to