diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java')
2 files changed, 10 insertions, 5 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java index 764fb67f69..7b6a2f6e1b 100644 --- a/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java +++ b/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java @@ -59,7 +59,8 @@ public class CometServiceBindingProvider implements ServiceBindingProvider { */ @Override public void start() { - ServletFactory.registerServlet(this.servletHost); + String deployedURI = ServletFactory.registerServlet(this.servletHost); + endpoint.setDeployedURI(deployedURI); final ComponentService service = this.endpoint.getService(); final Interface serviceInterface = service.getInterfaceContract().getInterface(); JavascriptGenerator.generateServiceProxy(service); diff --git a/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java b/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java index ed40ccd4f9..70a793404f 100644 --- a/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java +++ b/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java @@ -91,22 +91,26 @@ public final class ServletFactory { * @param servletHost * the underlying servlet host */ - public static synchronized void registerServlet( + public static synchronized String registerServlet( final ServletHost servletHost) { - registerCometServlet(servletHost); + String uri = registerCometServlet(servletHost); registerJavascriptServlet(servletHost); + return uri; } - private static void registerCometServlet(ServletHost servletHost) { + private static String registerCometServlet(ServletHost servletHost) { if (ServletFactory.cometServlet == null) { ServletFactory.cometServlet = new AtmosphereServlet(); ServletFactory.cometServlet.addInitParameter( ServletFactory.PACKAGE_KEY, ServletFactory.PACKAGE_VALUE); - servletHost.addServletMapping(ServletFactory.PATH, + String uri = servletHost.addServletMapping(ServletFactory.PATH, ServletFactory.cometServlet); final CometComponentContext context = new CometComponentContext(); ServletFactory.cometServlet.getServletContext().setAttribute( ServletFactory.COMET_COMPONENT_CONTEXT_KEY, context); + return uri; + } else { + return null; } } |