summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-01-14 12:06:55 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-01-14 12:06:55 +0000
commitd7d84af71f1aaf91a99ff016749a317978673b82 (patch)
tree1723ce5b9fd6b31f9d6cae8708c53e92892e7654
parent1d92c5421803fcb3338054bde63b1d6725be608e (diff)
Correctlt set the domain name based on the name in the config uri
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@899172 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java b/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java
index 15ef4023cf..ea6bb50cd7 100644
--- a/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java
+++ b/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java
@@ -100,7 +100,7 @@ public class ServletHostHelper {
} 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 @@ public class ServletHostHelper {
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) {