From a61fbe6d1907b8c8ce335ceaa4c4f0b30952410b Mon Sep 17 00:00:00 2001 From: antelder Date: Fri, 9 Apr 2010 14:00:31 +0000 Subject: Ensure a Node is created for each context git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@932418 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tuscany/sca/host/webapp/WebAppHelper.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sca-java-2.x/trunk/modules/host-webapp/src/main') diff --git a/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java b/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java index 7d086cd0f3..35d8c91750 100644 --- a/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java +++ b/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java @@ -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; } -- cgit v1.2.3