diff options
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() { |