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/04/09 16:00:31 UTC

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

Author: antelder
Date: Fri Apr  9 14:00:31 2010
New Revision: 932418

URL: http://svn.apache.org/viewvc?rev=932418&view=rev
Log:
Ensure a Node is created for each context

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

Modified: tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.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/WebAppHelper.java?rev=932418&r1=932417&r2=932418&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java Fri Apr  9 14:00:31 2010
@@ -140,13 +140,20 @@ public class WebAppHelper {
                     servletContext.setAttribute(name, value);
                 }
                 host = getServletHost(servletContext);
-                Node node = createAndStartNode(servletContext);
-                servletContext.setAttribute(SCA_NODE_ATTRIBUTE, node);
-                return host;
             } catch (ServletException e) {
                 throw new RuntimeException(e);
             }
         }
+        Node node = (Node)servletContext.getAttribute(SCA_NODE_ATTRIBUTE);
+        if (node == null) {
+            try {
+                node = createAndStartNode(servletContext);
+            } catch (ServletException e) {
+                throw new RuntimeException(e);
+            }
+            servletContext.setAttribute(SCA_NODE_ATTRIBUTE, node);
+        }
+
         return host;
     }