From c6d8ce981070daff40ef8b23558187066973924f Mon Sep 17 00:00:00 2001 From: fmoga Date: Tue, 3 Aug 2010 18:46:58 +0000 Subject: Set org.atmosphere.useNative to true in order to skip the TuscanyServletFilter exception regarding Servlets 3.0 and use native APIs. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@982001 13f79535-47bb-0310-9956-ffa450edef68 --- .../contrib/modules/binding-comet-runtime/pom.xml | 21 +++------------------ .../comet/runtime/CometServiceBindingProvider.java | 3 ++- .../sca/binding/comet/runtime/CometServlet.java | 12 ------------ .../java/org/apache/tuscany/sca/test/CometTest.java | 16 +++++++++++----- 4 files changed, 16 insertions(+), 36 deletions(-) (limited to 'sca-java-2.x/contrib/modules/binding-comet-runtime') diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime/pom.xml b/sca-java-2.x/contrib/modules/binding-comet-runtime/pom.xml index 9ff94ca831..61c53e974e 100644 --- a/sca-java-2.x/contrib/modules/binding-comet-runtime/pom.xml +++ b/sca-java-2.x/contrib/modules/binding-comet-runtime/pom.xml @@ -53,27 +53,12 @@ tuscany-host-http 2.0-SNAPSHOT - - org.codehaus.jackson - jackson-core-asl - 1.5.4 - - - org.codehaus.jackson - jackson-mapper-asl - 1.5.4 - - - org.apache.httpcomponents - httpclient - 4.0 - - javax.servlet - servlet-api - 2.5 + javax + javaee-web-api + 6.0 provided diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java index 3aeff7269f..7081081a14 100644 --- a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java +++ b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java @@ -44,9 +44,10 @@ public class CometServiceBindingProvider implements ServiceBindingProvider { ComponentService service = endpoint.getService(); Interface serviceInterface = service.getInterfaceContract().getInterface(); for (Operation op : serviceInterface.getOperations()) { - // CometServlet servlet = new CometServlet(endpoint, op); MeteorServlet servlet = new MeteorServlet(); servlet.addInitParameter("org.atmosphere.servlet", "org.apache.tuscany.sca.binding.comet.runtime.CometServlet"); + // TODO fix TuscanyServletFilter to use Servlets 3.0 + servlet.addInitParameter("org.atmosphere.useNative", "true"); String path = endpoint.getBinding().getURI() + "/" + op.getName(); servletHost.addServletMapping(path, servlet); System.out.println("Adding attributes to servlet context..."); diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServlet.java b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServlet.java index 7b8b39dcce..9f4d56ef71 100644 --- a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServlet.java +++ b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServlet.java @@ -45,18 +45,6 @@ public class CometServlet extends HttpServlet { protected transient Operation operation; private List filters; - public CometServlet() { - } - - public CometServlet(RuntimeEndpoint wire, Operation operation) { - System.out.println("Entering CometServlet constructor..."); - this.wire = wire; - this.operation = operation; - filters = new LinkedList(); - filters.add(new XSSHtmlFilter()); - filters.add(new ScriptFilter()); - } - @Override public void init(ServletConfig config) throws ServletException { System.out.println("Entering CometServlet#init..."); diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/CometTest.java b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/CometTest.java index 0b22515f7a..e58f06c91e 100644 --- a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/CometTest.java +++ b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/CometTest.java @@ -10,10 +10,16 @@ import org.apache.tuscany.sca.node.NodeFactory; public class CometTest extends TestCase { public void testComet() { - String location = ContributionLocationHelper.getContributionLocation("test.composite"); - Node node = NodeFactory.newInstance().createNode("test.composite", new Contribution("c1", location)); - node.start(); - node.stop(); + try { + String location = ContributionLocationHelper.getContributionLocation("test.composite"); + Node node = NodeFactory.newInstance().createNode("test.composite", new Contribution("c1", location)); + node.start(); + // System.out.println("Press any key to stop the node."); + // System.in.read(); + node.stop(); + } catch (Exception e) { + fail("Exception caught!"); + } } - + } -- cgit v1.2.3