diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-21 20:28:30 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-21 20:28:30 +0000 |
commit | 9b624f74edcead48b13634323224e2d972f7e6ce (patch) | |
tree | 9fc1a0f9cf0d49a0ca568d7e83dbe35ce9c7ec50 /sca-java-2.x/trunk/modules/host-webapp/src/main/java/org | |
parent | b8a63636ff2dbea555f14b42c5a49e1555e68f85 (diff) |
Bring up the servlet-scoped node start/stop with Spring MVC
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1083940 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/host-webapp/src/main/java/org')
2 files changed, 13 insertions, 7 deletions
diff --git a/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServlet.java b/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServlet.java index e8c8d941ff..d20019372e 100644 --- a/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServlet.java +++ b/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServlet.java @@ -46,7 +46,8 @@ public class TuscanyServlet extends HttpServlet { public void init(ServletConfig config) throws ServletException { try { super.init(config); - WebAppHelper.init(WebAppHelper.getConfigurator(this)); + configurator = WebAppHelper.getConfigurator(this); + WebAppHelper.init(configurator); } catch (Throwable e) { logger.log(Level.SEVERE, e.getMessage(), e); configurator.getServletContext().log(e.getMessage(), e); 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 41503f1cac..cfd034002d 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 @@ -196,7 +196,10 @@ public class WebAppHelper { } public static void stop(WebContextConfigurator configurator) { - Node node = (Node)configurator.getAttribute(SCA_NODE_ATTRIBUTE); + Node node = null; + if (configurator != null) { + node = (Node)configurator.getAttribute(SCA_NODE_ATTRIBUTE); + } if (node != null) { node.stop(); configurator.setAttribute(SCA_NODE_ATTRIBUTE, null); @@ -234,11 +237,6 @@ public class WebAppHelper { configuration = factory.loadConfiguration(url.openStream(), url); } else { configuration = factory.createNodeConfiguration(); - - configuration.setAttribute(ServletContext.class.getName(), servletContext); - if(configurator instanceof ServletConfigurator) { - configuration.setAttribute(Servlet.class.getName(), ((ServletConfigurator) configurator).servlet); - } boolean explicitContributions = false; Enumeration<String> names = configurator.getInitParameterNames(); @@ -322,6 +320,10 @@ public class WebAppHelper { } } } + configuration.setAttribute(ServletContext.class.getName(), servletContext); + if(configurator instanceof ServletConfigurator) { + configuration.setAttribute(Servlet.class.getName(), ((ServletConfigurator) configurator).servlet); + } return configuration; } @@ -428,11 +430,14 @@ public class WebAppHelper { public String getInitParameter(String name) { String value = config.getInitParameter(name); + return value; + /* if (value == null) { return config.getServletContext().getInitParameter(name); } else { return value; } + */ } public Enumeration<String> getInitParameterNames() { |