summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-07-08 04:55:06 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-07-08 04:55:06 +0000
commitc0eb69512f008224c063ab6bdd5585471635d43b (patch)
treedef467c01c93cf982106caacac01e4689242b5a3 /java
parentf062eb028069f8f15e489367b88358230a199f93 (diff)
Enable setting the domain used by the webapp via a context attribute
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@792033 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java b/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java
index c3aaf02e3a..c85ce6f265 100644
--- a/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java
+++ b/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java
@@ -40,6 +40,7 @@ import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
import org.apache.tuscany.sca.node.impl.NodeImpl;
public class ServletHostHelper {
+ public static final String DOMAIN_NAME_ATTR = "org.apache.tuscany.sca.domain.name";
public static final String SCA_NODE_ATTRIBUTE = Node.class.getName();
private static NodeFactory factory;
@@ -85,6 +86,7 @@ public class ServletHostHelper {
configuration = factory.loadConfiguration(openStream(servletContext, nodeConfigURI));
} else {
configuration = factory.createNodeConfiguration();
+ configuration.setDomainURI(factory.getDomainURI());
Enumeration<String> names = servletContext.getInitParameterNames();
while (names.hasMoreElements()) {
String name = names.nextElement();
@@ -120,7 +122,12 @@ public class ServletHostHelper {
Node node = (Node)servletContext.getAttribute(SCA_NODE_ATTRIBUTE);
if (node == null) {
try {
- factory = NodeFactory.newInstance();
+ String domainName = (String)servletContext.getAttribute(DOMAIN_NAME_ATTR);
+ if (domainName != null) {
+ factory = NodeFactory.getInstance(domainName);
+ } else {
+ factory = NodeFactory.newInstance();
+ }
node = createNode(servletContext);
servletContext.setAttribute(SCA_NODE_ATTRIBUTE, node);
getServletHost(node).init(new ServletConfig() {