From d265ff25c247dc3bb3933b468762cac419854944 Mon Sep 17 00:00:00 2001 From: antelder Date: Tue, 12 Aug 2008 12:26:30 +0000 Subject: Add the impl.web RuntimeComponent to the app context and use in the componentcontextservlet git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@685127 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/implementation/web/ComponentContextServlet.java | 5 ++++- .../implementation/web/runtime/WebImplementationProviderFactory.java | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'java/sca/modules/implementation-web-runtime/src/main') diff --git a/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ComponentContextServlet.java b/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ComponentContextServlet.java index c08129dc85..d6d015992d 100644 --- a/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ComponentContextServlet.java +++ b/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ComponentContextServlet.java @@ -34,6 +34,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.tuscany.sca.assembly.ComponentReference; +import org.apache.tuscany.sca.runtime.RuntimeComponent; /** * Servlet that handles the GET request for the componentContext.js script @@ -96,7 +97,9 @@ public class ComponentContextServlet extends HttpServlet { out.write("// SCA References\n"); - for (ComponentReference cr : WebSingleton.INSTANCE.getRuntimeComponent().getReferences()) { + RuntimeComponent component = (RuntimeComponent)servletContext.getAttribute("org.apache.tuscany.sca.implementation.web.RuntimeComponent"); + + for (ComponentReference cr : component.getReferences()) { String ref = "// SCA Reference " + cr.getName() + "\n"; out.write(ref); for (ContextScriptProcessor csp : WebSingleton.INSTANCE.getContextScriptProcessors()) { diff --git a/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java b/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java index 1692cb2b42..3b2f821b4f 100644 --- a/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java +++ b/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java @@ -56,6 +56,7 @@ public class WebImplementationProviderFactory implements ImplementationProviderF servletHost.addServletMapping("org.osoa.sca.componentContext.js", contextServlet); contextServlet.setAttribute("org.osoa.sca.ComponentContext", new ComponentContextProxy(component)); + contextServlet.setAttribute("org.apache.tuscany.sca.implementation.web.RuntimeComponent", component); WebAppServletHost.getInstance().setAttribute("org.osoa.sca.ComponentContext", new ComponentContextProxy(component)); return new ImplementationProvider() { -- cgit v1.2.3