From 25d03792990d853fcad19364f9c08718f968730f Mon Sep 17 00:00:00 2001 From: lresende Date: Fri, 27 Mar 2009 08:28:11 +0000 Subject: TUSCANY-2837 - Updates to start using Javascript extension points to generate js client proxies git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@759050 13f79535-47bb-0310-9956-ffa450edef68 --- .../widget/provider/WidgetImplementationProvider.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java') diff --git a/branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java b/branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java index 26f8c78677..8f1511f483 100644 --- a/branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java +++ b/branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java @@ -23,6 +23,7 @@ import java.net.URI; import javax.servlet.Servlet; import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.core.web.JavascriptProxyFactoryExtensionPoint; import org.apache.tuscany.sca.host.http.ServletHost; import org.apache.tuscany.sca.implementation.widget.WidgetImplementation; import org.apache.tuscany.sca.interfacedef.Operation; @@ -41,6 +42,7 @@ class WidgetImplementationProvider implements ImplementationProvider { private RuntimeComponent component; + private JavascriptProxyFactoryExtensionPoint javascriptProxyFactories; private ServletHost servletHost; private String widgetLocationURL; @@ -52,9 +54,13 @@ class WidgetImplementationProvider implements ImplementationProvider { /** * Constructs a new resource implementation provider. */ - WidgetImplementationProvider(RuntimeComponent component, WidgetImplementation implementation, ServletHost servletHost) { + WidgetImplementationProvider(RuntimeComponent component, + WidgetImplementation implementation, + JavascriptProxyFactoryExtensionPoint javascriptProxyFactories, + ServletHost servletHost) { this.component = component; + this.javascriptProxyFactories = javascriptProxyFactories; this.servletHost = servletHost; widgetLocationURL = implementation.getLocationURL().toString(); @@ -65,7 +71,7 @@ class WidgetImplementationProvider implements ImplementationProvider { } public Invoker createInvoker(RuntimeComponentService service, Operation operation) { - WidgetImplementationInvoker invoker = new WidgetImplementationInvoker(component, widgetName, widgetFolderURL, widgetLocationURL); + WidgetImplementationInvoker invoker = new WidgetImplementationInvoker(component, javascriptProxyFactories, widgetName, widgetFolderURL, widgetLocationURL); return invoker; } @@ -74,8 +80,6 @@ class WidgetImplementationProvider implements ImplementationProvider { } public void start() { - System.out.println(">>> Starting component : " + this.component.getName()); - String contextRoot = getContextRoot(); // get the ScaDomainScriptServlet, if it doesn't yet exist create one @@ -84,7 +88,7 @@ class WidgetImplementationProvider implements ImplementationProvider { Servlet servlet = servletHost.getServletMapping(scriptURI); if (servlet == null /*|| servlet instanceof HTTPGetListenerServlet*/) { WidgetComponentScriptServlet widgetScriptServlet; - widgetScriptServlet = new WidgetComponentScriptServlet(this.component); + widgetScriptServlet = new WidgetComponentScriptServlet(this.component, javascriptProxyFactories); servletHost.addServletMapping(scriptURI, widgetScriptServlet); } else { System.out.println(">>>Servlet::" + servlet.getClass().toString()); @@ -101,6 +105,10 @@ class WidgetImplementationProvider implements ImplementationProvider { } + /** + * Get the contextRoot considering the HTTP Binding URI when in a embedded environment + * @return + */ private String getContextRoot() { String contextRoot = null; -- cgit v1.2.3