You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2010/01/14 13:06:56 UTC

svn commit: r899172 - /tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java

Author: antelder
Date: Thu Jan 14 12:06:55 2010
New Revision: 899172

URL: http://svn.apache.org/viewvc?rev=899172&view=rev
Log:
Correctlt set the domain name based on the name in the config uri

Modified:
    tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java

Modified: tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java?rev=899172&r1=899171&r2=899172&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java Thu Jan 14 12:06:55 2010
@@ -100,7 +100,7 @@
             } else {
                 domainURI = servletContext.getInitParameter("org.apache.tuscany.sca.defaultDomainURI");
                 if (domainURI != null) {
-                    configuration.setDomainURI(domainURI);
+                    configuration.setDomainURI(getDomainName(domainURI));
                     configuration.setDomainRegistryURI(domainURI);
                 }
             }
@@ -108,6 +108,24 @@
         return configuration;
     }
 
+    // TODO: Temp for now to get the old samples working till i clean up all the domain uri/name after the ML discussion.
+    private static String getDomainName(String configURI) {
+        String domainName;
+        if (configURI.startsWith("tuscany:vm:")) {
+            domainName = configURI.substring("tuscany:vm:".length());  
+        } else if (configURI.startsWith("tuscany:")) {
+            int i = configURI.indexOf('?');
+            if (i == -1) {
+                domainName = configURI.substring("tuscany:".length());  
+            } else{
+                domainName = configURI.substring("tuscany:".length(), i);  
+            }
+        } else {
+            domainName = configURI;  
+        }
+        return domainName;
+    }
+    
     public static ServletHost init(final ServletContext servletContext) {
         Node node = (Node)servletContext.getAttribute(SCA_NODE_ATTRIBUTE);
         if (node == null) {