diff options
author | fmoga <fmoga@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-25 12:15:36 +0000 |
---|---|---|
committer | fmoga <fmoga@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-25 12:15:36 +0000 |
commit | 35974e417c11015b7851863875b303f7f9b3ce92 (patch) | |
tree | 1deed540162d2630d68d007955a12642039a680c /sca-java-2.x/trunk/modules/binding-comet-runtime/src | |
parent | 01d244ef2681dc366e994ec5962456d07d75d148 (diff) |
Upgrade to atmosphere-jersey 0.7.1. Change REST Path for CometComponentContext.js to avoid mapping exception caused by new jersey version.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1127488 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
4 files changed, 9 insertions, 7 deletions
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 70a793404f..150d6977e2 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 @@ -66,7 +66,7 @@ public final class ServletFactory { /** * Path where Javascript toolkit will be exposed. */ - public static final String JS_PATH = "/org.apache.tuscany.sca.cometComponentContext.js/*"; + public static final String JS_PATH = "/tuscany-comet-js/*"; /** * The servlet that is exposing the comet services. diff --git a/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java b/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java index 0d47b72f8b..3a9dcac049 100644 --- a/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java +++ b/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java @@ -22,6 +22,7 @@ package org.apache.tuscany.sca.binding.comet.runtime.handler; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.TimeUnit; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; @@ -45,13 +46,11 @@ import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; -import org.atmosphere.cache.SessionBroadcasterCache; import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.DefaultBroadcaster; -import org.atmosphere.cpr.DefaultBroadcasterFactory; +import org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY; +import org.atmosphere.cpr.BroadcasterLifeCyclePolicy.Builder; import org.atmosphere.jersey.JerseyBroadcaster; import org.atmosphere.jersey.SuspendResponse; -import org.atmosphere.jersey.util.JerseyBroadcasterUtil; import com.sun.jersey.spi.container.servlet.PerSession; @@ -101,6 +100,8 @@ public class CometBindingHandler { System.out.println("-- connect -- Session Id: " + request.getSession().getId()); if (broadcaster == null) { broadcaster = new JerseyBroadcaster(); +// broadcaster.setBroadcasterLifeCyclePolicy(new Builder().policy(ATMOSPHERE_RESOURCE_POLICY.IDLE_DESTROY) +// .idleTimeInMS(5000).build()); context = (CometComponentContext) sc.getAttribute(ServletFactory.COMET_COMPONENT_CONTEXT_KEY); } CometComponentContext.broadcasters.put(request.getSession().getId(), broadcaster); @@ -127,7 +128,7 @@ public class CometBindingHandler { @POST @Path("/{service}/{method}") public void handleRequest(@PathParam("service") final String service, @PathParam("method") final String method, - @FormParam("callback") final String callbackMethod, @FormParam("params") final String jsonData) + @FormParam("callbackMethod") final String callbackMethod, @FormParam("params") final String jsonData) throws InvocationTargetException { System.out.println("-- handleRequest -- Session Id: " + request.getSession().getId()); final String url = "/" + service + "/" + method; diff --git a/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptResource.java b/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptResource.java index 9274009803..4f301a4d0b 100644 --- a/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptResource.java +++ b/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptResource.java @@ -46,6 +46,7 @@ public class JavascriptResource { * @return InputStream containing the Javascript code. */ @GET + @Path("/org.apache.tuscany.sca.CometComponentContext.js") public InputStream getJavascript() { InputStream stream = null; // add dependencies in the specified order diff --git a/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/resources/cometComponentContext.js b/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/resources/cometComponentContext.js index 2518ee4367..60bbbe4b98 100644 --- a/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/resources/cometComponentContext.js +++ b/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/resources/cometComponentContext.js @@ -36,7 +36,7 @@ this.TuscanyComet = { null, $.atmosphere.request = { method : 'POST', - data : 'callback=' + callbackMethod.name + '¶ms=' + params + data : 'callbackMethod=' + callbackMethod.name + '¶ms=' + params }); }, callback : function(response) { |