You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ay...@apache.org on 2014/04/01 17:18:33 UTC

git commit: CAMEL-5353: atmosphere based websocket severside component

Repository: camel
Updated Branches:
  refs/heads/master d3a8de45c -> c1e681464


CAMEL-5353: atmosphere based websocket severside component


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c1e68146
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c1e68146
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c1e68146

Branch: refs/heads/master
Commit: c1e6814643258c79775369e32ee40e074b935137
Parents: d3a8de4
Author: Akitoshi Yoshida <ay...@apache.org>
Authored: Tue Apr 1 17:17:45 2014 +0200
Committer: Akitoshi Yoshida <ay...@apache.org>
Committed: Tue Apr 1 17:18:16 2014 +0200

----------------------------------------------------------------------
 apache-camel/pom.xml                            |   4 +
 .../src/main/descriptors/common-bin.xml         |   1 +
 components/camel-atmosphere-websocket/pom.xml   | 122 +++++++++++
 .../websocket/CamelWebSocketServlet.java        |  67 ++++++
 .../websocket/MemoryWebSocketStore.java         | 104 +++++++++
 .../atmosphere/websocket/WebSocketStore.java    |  21 ++
 .../websocket/WebsocketComponent.java           |  60 ++++++
 .../websocket/WebsocketConstants.java           |  12 ++
 .../atmosphere/websocket/WebsocketConsumer.java |  76 +++++++
 .../atmosphere/websocket/WebsocketEndpoint.java |  93 ++++++++
 .../atmosphere/websocket/WebsocketHandler.java  |  76 +++++++
 .../atmosphere/websocket/WebsocketProducer.java | 103 +++++++++
 .../websocket/WebsocketStreamHandler.java       |  33 +++
 .../src/main/resources/META-INF/LICENSE.txt     | 203 +++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt      |  11 +
 .../apache/camel/component/atmosphere-websocket |  17 ++
 .../wsservlet/MemoryWebSocketStoreTest.java     |  59 +++++
 .../camel/component/wsservlet/TestClient.java   | 165 ++++++++++++++
 .../WebsocketCamelRouterTestSupport.java        |  71 ++++++
 .../component/wsservlet/WebsocketRouteTest.java | 216 +++++++++++++++++++
 .../src/test/resources/log4j.properties         |  39 ++++
 .../component/atmosphere/websocket/web.xml      |  40 ++++
 parent/pom.xml                                  |   6 +
 .../features/src/main/resources/features.xml    |   6 +
 24 files changed, 1605 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/apache-camel/pom.xml
----------------------------------------------------------------------
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index e4128f6..dce9c39 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -69,6 +69,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-atmosphere-websocket</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-atom</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/apache-camel/src/main/descriptors/common-bin.xml
----------------------------------------------------------------------
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index b4bf6c1..a0b5996 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -28,6 +28,7 @@
         <include>org.apache.camel:camel-ahc-ws</include>
         <include>org.apache.camel:camel-amqp</include>
         <include>org.apache.camel:camel-apns</include>
+        <include>org.apache.camel:camel-atmosphere-websocket</include>
         <include>org.apache.camel:camel-atom</include>
         <include>org.apache.camel:camel-aws</include>
         <include>org.apache.camel:camel-avro</include>

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/pom.xml b/components/camel-atmosphere-websocket/pom.xml
new file mode 100644
index 0000000..dcf2f2e
--- /dev/null
+++ b/components/camel-atmosphere-websocket/pom.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>components</artifactId>
+        <version>2.14-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-atmosphere-websocket</artifactId>
+    <packaging>bundle</packaging>
+    <name>Camel :: Atmosphere WebSocket Servlet</name>
+    <description>Camel Atmosphere WebSocket Servlet</description>
+
+    <properties>
+        <camel.osgi.export.pkg>
+            org.apache.camel.component.atmosphere.websocket.*;${camel.osgi.version}
+        </camel.osgi.export.pkg>
+        <camel.osgi.import.pkg>
+            !org.apache.camel.component.atmosphere.websocket.*,
+            javax.servlet*;version="2.5",
+            org.apache.catalina;resolution:=optional,
+            org.apache.catalina.comet;resolution:=optional,
+            org.eclipse.jetty.continuation;version="[7.6,8.2)";resolution:=optional,
+            org.eclipse.jetty.server;version="[7.6,8.2)";resolution:=optional,
+            org.eclipse.jetty.util.ssl;version="[7.6,8.2)";resolution:=optional,
+            ${camel.osgi.import.defaults},
+            *
+        </camel.osgi.import.pkg>
+        <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=atmosphere-websocket</camel.osgi.export.service>
+    </properties>
+
+    <dependencies>
+        <!-- Camel -->
+        <dependency>
+          <groupId>org.apache.camel</groupId>
+          <artifactId>camel-core</artifactId>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.camel</groupId>
+          <artifactId>camel-servlet</artifactId>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-servlet_3.0_spec</artifactId>
+          <version>${geronimo-servlet-spec-version}</version>
+        </dependency>
+
+        <!--  atmosphere -->
+        <dependency>
+            <groupId>org.atmosphere</groupId>
+            <artifactId>atmosphere-runtime</artifactId>
+            <version>${atmosphere-version}</version>
+        </dependency>
+        
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymockclassextension</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.ning</groupId>
+            <artifactId>async-http-client</artifactId>
+            <version>${ahc-version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- Jetty for testing--> 
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-websocket</artifactId>
+            <version>${jetty-version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-servlet</artifactId>
+            <version>${jetty-version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+           <groupId>org.slf4j</groupId>
+          <artifactId>slf4j-log4j12</artifactId>
+          <scope>test</scope>
+       </dependency>
+
+       <!-- Jetty for testing -->
+        
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/CamelWebSocketServlet.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/CamelWebSocketServlet.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/CamelWebSocketServlet.java
new file mode 100644
index 0000000..3ed2c37
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/CamelWebSocketServlet.java
@@ -0,0 +1,67 @@
+/**
+ * 
+ */
+package org.apache.camel.component.atmosphere.websocket;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.camel.component.http.HttpConsumer;
+import org.apache.camel.component.servlet.CamelHttpTransportServlet;
+
+/**
+ * This servlet is used to add some websocket specific handling at the moment.
+ * 
+ * REVISIT
+ * we might be able to get rid of this servlet by overriding some of the binding
+ * code that is executed between the servlet and the consumer.
+ * 
+ */
+public class CamelWebSocketServlet extends CamelHttpTransportServlet {
+    private static final long serialVersionUID = 1764707448550670635L;
+
+    @Override
+    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,
+        IOException {
+        log.trace("Service: {}", request);
+
+        // Is there a consumer registered for the request.
+        HttpConsumer consumer = resolve(request);
+        if (consumer == null) {
+            log.debug("No consumer to service request {}", request);
+            response.sendError(HttpServletResponse.SC_NOT_FOUND);
+            return;
+        }       
+        
+        // are we suspended?
+        if (consumer.isSuspended()) {
+            log.debug("Consumer suspended, cannot service request {}", request);
+            response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
+            return;
+        }
+        
+        if (consumer.getEndpoint().getHttpMethodRestrict() != null 
+            && !consumer.getEndpoint().getHttpMethodRestrict().equals(request.getMethod())) {
+            response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+            return;
+        }
+
+        if ("TRACE".equals(request.getMethod()) && !consumer.isTraceEnabled()) {
+            response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+            return;
+        }
+
+        if (!(consumer instanceof WebsocketConsumer)) {
+            log.debug("Consumer not supporting websocket {}", request);
+            response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
+            return;
+        }
+        
+        log.debug("Dispatching to Websocket Consumer at {}", consumer.getPath());
+        ((WebsocketConsumer)consumer).service(request, response);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/MemoryWebSocketStore.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/MemoryWebSocketStore.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/MemoryWebSocketStore.java
new file mode 100644
index 0000000..3dfab01
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/MemoryWebSocketStore.java
@@ -0,0 +1,104 @@
+/**
+ * 
+ */
+package org.apache.camel.component.atmosphere.websocket;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.atmosphere.websocket.WebSocket;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ */
+public class MemoryWebSocketStore implements WebSocketStore {
+    private static final transient Logger LOG = LoggerFactory.getLogger(MemoryWebSocketStore.class);
+    
+    private Map<String, WebSocket> values;
+    private Map<WebSocket, String> keys;
+    
+    public MemoryWebSocketStore() {
+        values = new ConcurrentHashMap<String, WebSocket>();
+        keys = new ConcurrentHashMap<WebSocket, String>();
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.camel.Service#start()
+     */
+    @Override
+    public void start() throws Exception {
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.camel.Service#stop()
+     */
+    @Override
+    public void stop() throws Exception {
+        values.clear();
+        keys.clear();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.camel.component.websocket2.WebsocketStore#addWebSocket(java.lang.String, org.atmosphere.websocket.WebSocket)
+     */
+    @Override
+    public void addWebSocket(String connectionKey, WebSocket websocket) {
+        values.put(connectionKey, websocket);
+        keys.put(websocket, connectionKey);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("added websocket {} => {}", connectionKey, websocket);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.camel.component.websocket2.WebsocketStore#removeWebSocket(java.lang.String)
+     */
+    @Override
+    public void removeWebSocket(String connectionKey) {
+        Object obj = values.remove(connectionKey);
+        if (obj != null) {
+            keys.remove(obj);
+        }
+        LOG.debug("removed websocket {}", connectionKey);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.camel.component.websocket2.WebsocketStore#removeWebSocket(org.atmosphere.websocket.WebSocket)
+     */
+    @Override
+    public void removeWebSocket(WebSocket websocket) {
+        Object obj = keys.remove(websocket);
+        if (obj != null) {
+            values.remove(obj);
+        }
+        LOG.debug("removed websocket {}", websocket);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.camel.component.websocket2.WebsocketStore#getConnectionKey(org.atmosphere.websocket.WebSocket)
+     */
+    @Override
+    public String getConnectionKey(WebSocket websocket) {
+        return keys.get(websocket);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.camel.component.websocket2.WebsocketStore#getWebSocket(java.lang.String)
+     */
+    @Override
+    public WebSocket getWebSocket(String connectionKey) {
+        return values.get(connectionKey);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.camel.component.websocket2.WebsocketStore#getAllWebSockets()
+     */
+    @Override
+    public Collection<WebSocket> getAllWebSockets() {
+        return values.values();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebSocketStore.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebSocketStore.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebSocketStore.java
new file mode 100644
index 0000000..c5b1eb3
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebSocketStore.java
@@ -0,0 +1,21 @@
+/**
+ * 
+ */
+package org.apache.camel.component.atmosphere.websocket;
+
+import java.util.Collection;
+
+import org.apache.camel.Service;
+import org.atmosphere.websocket.WebSocket;
+
+/**
+ *
+ */
+public interface WebSocketStore extends Service {
+    void addWebSocket(String connectionKey, WebSocket websocket);
+    void removeWebSocket(String connectionKey);
+    void removeWebSocket(WebSocket websocket);
+    String getConnectionKey(WebSocket websocket);
+    WebSocket getWebSocket(String connectionKey);
+    Collection<WebSocket> getAllWebSockets();
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketComponent.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketComponent.java
new file mode 100644
index 0000000..7c34b1a
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketComponent.java
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.atmosphere.websocket;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.component.http.HttpClientConfigurer;
+import org.apache.camel.component.servlet.ServletComponent;
+import org.apache.camel.component.servlet.ServletEndpoint;
+import org.apache.commons.httpclient.HttpConnectionManager;
+import org.apache.commons.httpclient.params.HttpClientParams;
+
+
+public class WebsocketComponent extends ServletComponent {
+    private Map<String, WebSocketStore> stores;
+    
+    public WebsocketComponent() {
+        // override the default servlet name of ServletComponent
+        setServletName("CamelWsServlet");
+        
+        this.stores = new HashMap<String, WebSocketStore>();
+    }
+    
+    @Override
+    protected ServletEndpoint createServletEndpoint(String endpointUri, ServletComponent component,
+                                                    URI httpUri, HttpClientParams params,
+                                                    HttpConnectionManager httpConnectionManager,
+                                                    HttpClientConfigurer clientConfigurer) throws Exception {
+        
+        return new WebsocketEndpoint(endpointUri, (WebsocketComponent)component, httpUri, params, httpConnectionManager, clientConfigurer);
+    }
+    
+    WebSocketStore getWebSocketStore(String name) {
+        WebSocketStore store;
+        synchronized (stores) {
+            store = stores.get(name);
+            if (store == null) {
+                store = new MemoryWebSocketStore();
+                stores.put(name, store);
+            }
+        }
+        return store;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConstants.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConstants.java
new file mode 100644
index 0000000..b7f9f97
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConstants.java
@@ -0,0 +1,12 @@
+/**
+ * 
+ */
+package org.apache.camel.component.atmosphere.websocket;
+
+/**
+ *
+ */
+public class WebsocketConstants {
+    public static final String CONNECTION_KEY = "websocket.connectionKey";
+    public static final String SEND_TO_ALL = "websocket.sendToAll";
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConsumer.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConsumer.java
new file mode 100644
index 0000000..3e69133
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConsumer.java
@@ -0,0 +1,76 @@
+/**
+ * 
+ */
+package org.apache.camel.component.atmosphere.websocket;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.component.servlet.ServletConsumer;
+import org.atmosphere.cpr.ApplicationConfig;
+import org.atmosphere.cpr.AtmosphereFramework;
+import org.atmosphere.cpr.AtmosphereRequest;
+import org.atmosphere.cpr.AtmosphereResponse;
+import org.atmosphere.websocket.WebSocketProtocol;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ */
+public class WebsocketConsumer extends ServletConsumer {
+    private static final transient Logger LOG = LoggerFactory.getLogger(WebsocketConsumer.class);
+    
+    private AtmosphereFramework framework;
+    
+    public WebsocketConsumer(WebsocketEndpoint endpoint, Processor processor) {
+        super(endpoint, processor);
+        this.framework = new AtmosphereFramework(false, true);
+
+        framework.setUseNativeImplementation(false);
+        framework.addInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT, "true");
+        framework.addInitParameter(ApplicationConfig.WEBSOCKET_PROTOCOL, 
+            endpoint.isUseStreaming() ? WebsocketStreamHandler.class.getName() : WebsocketHandler.class.getName());
+        framework.init();
+        
+        WebSocketProtocol wsp = framework.getWebSocketProtocol();
+        if (wsp instanceof WebsocketHandler) {
+            ((WebsocketHandler)wsp).setConsumer(this);            
+        } else {
+            // this should not normally happen
+            LOG.error("unexpected WebSocketHandler: {}", wsp);
+        }
+    }
+
+    @Override
+    public WebsocketEndpoint getEndpoint() {
+        return (WebsocketEndpoint)super.getEndpoint();
+    }
+    
+    void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
+        framework.doCometSupport(AtmosphereRequest.wrap(request), AtmosphereResponse.wrap(response));
+    }
+
+    public void sendMessage(final String connectionKey, Object message) {
+        final Exchange exchange = getEndpoint().createExchange();
+
+        // set header and body
+        exchange.getIn().setHeader(WebsocketConstants.CONNECTION_KEY, connectionKey);
+        exchange.getIn().setBody(message);
+
+        // send exchange using the async routing engine
+        getAsyncProcessor().process(exchange, new AsyncCallback() {
+            public void done(boolean doneSync) {
+                if (exchange.getException() != null) {
+                    getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
+                }
+            }
+        });
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketEndpoint.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketEndpoint.java
new file mode 100644
index 0000000..257a66c
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketEndpoint.java
@@ -0,0 +1,93 @@
+/**
+ * 
+ */
+package org.apache.camel.component.atmosphere.websocket;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.http.HttpClientConfigurer;
+import org.apache.camel.component.servlet.ServletEndpoint;
+import org.apache.commons.httpclient.HttpConnectionManager;
+import org.apache.commons.httpclient.params.HttpClientParams;
+
+/**
+ *
+ */
+public class WebsocketEndpoint extends ServletEndpoint {
+    private WebSocketStore store;
+    private boolean sendToAll;
+    private boolean useStreaming;
+    
+    public WebsocketEndpoint(String endPointURI, WebsocketComponent component, URI httpUri, HttpClientParams params, HttpConnectionManager httpConnectionManager,
+                             HttpClientConfigurer clientConfigurer) throws URISyntaxException {
+        super(endPointURI, component, httpUri, params, httpConnectionManager, clientConfigurer);
+
+        //TODO find a better way of assigning the store
+        int idx = endPointURI.indexOf('?');
+        String name = idx > -1 ? endPointURI.substring(0, idx) : endPointURI;
+        this.store = component.getWebSocketStore(name);
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.apache.camel.Endpoint#createProducer()
+     */
+    @Override
+    public Producer createProducer() throws Exception {
+        return new WebsocketProducer(this);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.camel.Endpoint#createConsumer(org.apache.camel.Processor)
+     */
+    @Override
+    public Consumer createConsumer(Processor processor) throws Exception {
+        return new WebsocketConsumer(this, processor);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.camel.IsSingleton#isSingleton()
+     */
+    @Override
+    public boolean isSingleton() {
+        return true;
+    }
+
+
+    /**
+     * @return the sendToAll
+     */
+    public boolean isSendToAll() {
+        return sendToAll;
+    }
+
+    /**
+     * @param sendToAll the sendToAll to set
+     */
+    public void setSendToAll(boolean sendToAll) {
+        this.sendToAll = sendToAll;
+    }
+    
+    /**
+     * @return the useStreaming
+     */
+    public boolean isUseStreaming() {
+        return useStreaming;
+    }
+
+    /**
+     * @param useStreaming the useStreaming to set
+     */
+    public void setUseStreaming(boolean useStreaming) {
+        this.useStreaming = useStreaming;
+    }
+
+
+    WebSocketStore getWebSocketStore() {
+        return store;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketHandler.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketHandler.java
new file mode 100644
index 0000000..fbdac7a
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketHandler.java
@@ -0,0 +1,76 @@
+package org.apache.camel.component.atmosphere.websocket;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.atmosphere.cpr.AtmosphereConfig;
+import org.atmosphere.cpr.AtmosphereRequest;
+import org.atmosphere.websocket.WebSocket;
+import org.atmosphere.websocket.WebSocketProcessor.WebSocketException;
+import org.atmosphere.websocket.WebSocketProtocol;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WebsocketHandler implements WebSocketProtocol {
+    private static final transient Logger LOG = LoggerFactory.getLogger(WebsocketHandler.class);
+    
+    protected WebsocketConsumer consumer;
+    protected WebSocketStore store;
+
+    @Override
+    public void configure(AtmosphereConfig config) {
+        // TODO Auto-generated method stub
+    }
+    
+    @Override
+    public void onClose(WebSocket webSocket) {
+        LOG.info("closing websocket");
+        store.removeWebSocket(webSocket);
+        
+        LOG.info("websocket closed");
+    }
+
+    @Override
+    public void onError(WebSocket webSocket, WebSocketException t) {
+        LOG.error("websocket on error", t);
+    }
+
+    @Override
+    public void onOpen(WebSocket webSocket) {
+        LOG.info("opening websocket");
+        String connectionKey = UUID.randomUUID().toString();
+        store.addWebSocket(connectionKey, webSocket);
+        LOG.info("websocket opened");
+    }
+
+    @Override
+    public List<AtmosphereRequest> onMessage(WebSocket webSocket, String data) {
+        LOG.info("processing text message {}", data);
+        String connectionKey = store.getConnectionKey(webSocket);
+        consumer.sendMessage(connectionKey, data);
+        LOG.info("text message sent");
+        return null;
+    }
+    
+    @Override
+    public List<AtmosphereRequest> onMessage(WebSocket webSocket, byte[] data, int offset, int length) {
+        LOG.info("processing byte message {}", data);
+        String connectionKey = store.getConnectionKey(webSocket);
+        if (length < data.length) {
+            // create a copy that contains the relevant section as camel expects bytes without offset.
+            // alternatively, we could pass a BAIS reading this byte array from the offset.
+            byte[] rawdata = data;
+            data = new byte[length];
+            System.arraycopy(rawdata, offset, data, 0, length);
+        }
+        consumer.sendMessage(connectionKey, data);
+        LOG.info("byte message sent");
+        return null;
+    }
+
+    public void setConsumer(WebsocketConsumer consumer) {
+        this.consumer = consumer;
+        this.store = consumer.getEndpoint().getWebSocketStore();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketProducer.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketProducer.java
new file mode 100644
index 0000000..abc726e
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketProducer.java
@@ -0,0 +1,103 @@
+/**
+ * 
+ */
+package org.apache.camel.component.atmosphere.websocket;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.impl.DefaultProducer;
+import org.atmosphere.websocket.WebSocket;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ */
+public class WebsocketProducer extends DefaultProducer {
+    private static final transient Logger LOG = LoggerFactory.getLogger(WebsocketProducer.class);
+
+    private static ExecutorService executor = Executors.newSingleThreadExecutor();
+    
+    public WebsocketProducer(WebsocketEndpoint endpoint) {
+        super(endpoint);
+    }
+
+    @Override
+    public WebsocketEndpoint getEndpoint() {
+        return (WebsocketEndpoint) super.getEndpoint();
+    }
+
+    @Override
+    public void process(Exchange exchange) throws Exception {
+        Message in = exchange.getIn();
+        //TODO support binary data
+        Object message = in.getBody();
+        if (message == null) {
+            LOG.info("Ignoring a null message");
+            return;
+        }
+        
+        if (!(message instanceof String || message instanceof byte[] 
+            || message instanceof Reader || message instanceof InputStream)) {
+            // fallback to use String
+            if (LOG.isInfoEnabled()) {
+                LOG.info("Using String for unexpected message type {} ", message.getClass());
+            }
+            message = in.getBody(String.class);    
+        }
+        
+        // REVISIT Reader and InputStream handling at Producer 
+        // special conversion for Reader and InputStream for now 
+        if (message instanceof Reader) {
+            message = in.getBody(String.class);
+        } else if (message instanceof InputStream) {
+            message = in.getBody(byte[].class);
+        }
+        
+        log.debug("Sending to {}", message);
+        if (getEndpoint().isSendToAll()) {
+            log.debug("Sending to all -> {}", message);
+	    //TODO consider using atmosphere's broadcast or a more configurable async send
+            for (final WebSocket websocket : getEndpoint().getWebSocketStore().getAllWebSockets()) {
+                final Object msg = message;
+                executor.execute(new Runnable() {
+                    @Override
+                    public void run() {
+                        sendMessage(websocket, msg);
+                    }
+                });
+            }
+        } else {
+            // look for connection key and get Websocket
+            String connectionKey = in.getHeader(WebsocketConstants.CONNECTION_KEY, String.class);
+            if (connectionKey != null) {
+                WebSocket websocket = getEndpoint().getWebSocketStore().getWebSocket(connectionKey);
+                log.debug("Sending to connection key {} -> {}", connectionKey, message);
+                sendMessage(websocket, message);
+            } else {
+                throw new IllegalArgumentException("Failed to send message to single connection; connetion key not set.");
+            }
+            
+        }
+    }
+
+    private void sendMessage(WebSocket websocket, Object message) {
+        try {
+            if (message instanceof String) {
+                websocket.write((String)message);
+            } else if (message instanceof byte[]) {
+                websocket.write((byte[])message, 0, ((byte[])message).length);
+            } else {
+                // this should not happen unless one of the supported types is missing above.
+                LOG.error("unexpected message type {}", message == null ? null : message.getClass());
+            }
+        } catch (Exception e) {
+            LOG.error("Error when writing to websocket", e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketStreamHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketStreamHandler.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketStreamHandler.java
new file mode 100644
index 0000000..9d54d36
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketStreamHandler.java
@@ -0,0 +1,33 @@
+package org.apache.camel.component.atmosphere.websocket;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.List;
+
+import org.atmosphere.cpr.AtmosphereRequest;
+import org.atmosphere.websocket.WebSocket;
+import org.atmosphere.websocket.WebSocketProtocolStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WebsocketStreamHandler extends WebsocketHandler implements WebSocketProtocolStream {
+    private static final transient Logger LOG = LoggerFactory.getLogger(WebsocketStreamHandler.class);
+
+    @Override
+    public List<AtmosphereRequest> onTextStream(WebSocket webSocket, Reader data) {
+        LOG.info("processing reader message {}", data);
+        String connectionKey = store.getConnectionKey(webSocket);
+        consumer.sendMessage(connectionKey, data);
+        LOG.info("reader message sent");
+        return null;
+    }
+
+    @Override
+    public List<AtmosphereRequest> onBinaryStream(WebSocket webSocket, InputStream data) {
+        LOG.info("processing inputstream message {}", data);
+        String connectionKey = store.getConnectionKey(webSocket);
+        consumer.sendMessage(connectionKey, data);
+        LOG.info("reader message sent");
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/resources/META-INF/LICENSE.txt b/components/camel-atmosphere-websocket/src/main/resources/META-INF/LICENSE.txt
new file mode 100755
index 0000000..6b0b127
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/resources/META-INF/NOTICE.txt b/components/camel-atmosphere-websocket/src/main/resources/META-INF/NOTICE.txt
new file mode 100755
index 0000000..2e215bf
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/main/resources/META-INF/services/org/apache/camel/component/atmosphere-websocket
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/resources/META-INF/services/org/apache/camel/component/atmosphere-websocket b/components/camel-atmosphere-websocket/src/main/resources/META-INF/services/org/apache/camel/component/atmosphere-websocket
new file mode 100755
index 0000000..3ca5b7d
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/main/resources/META-INF/services/org/apache/camel/component/atmosphere-websocket
@@ -0,0 +1,17 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+class=org.apache.camel.component.atmosphere.websocket.WebsocketComponent

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/MemoryWebSocketStoreTest.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/MemoryWebSocketStoreTest.java b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/MemoryWebSocketStoreTest.java
new file mode 100644
index 0000000..9f69151
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/MemoryWebSocketStoreTest.java
@@ -0,0 +1,59 @@
+/**
+ * 
+ */
+package org.apache.camel.component.wsservlet;
+
+import java.util.UUID;
+
+import org.apache.camel.component.atmosphere.websocket.MemoryWebSocketStore;
+import org.atmosphere.websocket.WebSocket;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class MemoryWebSocketStoreTest extends Assert {
+    
+    @Test
+    public void testAddAndRemove() throws Exception {
+        MemoryWebSocketStore store = new MemoryWebSocketStore();
+        WebSocket webSocket1 = EasyMock.createMock(WebSocket.class);
+        WebSocket webSocket2 = EasyMock.createMock(WebSocket.class);
+        
+        String connectionKey1 = UUID.randomUUID().toString();
+        String connectionKey2 = UUID.randomUUID().toString();
+        
+        store.addWebSocket(connectionKey1, webSocket1);
+        verifyGet(store, connectionKey1, webSocket1, true);
+        assertEquals(1, store.getAllWebSockets().size());
+        
+        store.addWebSocket(connectionKey2, webSocket2);
+        verifyGet(store, connectionKey2, webSocket2, true);
+        verifyGet(store, connectionKey1, webSocket1, true);
+        assertEquals(2, store.getAllWebSockets().size());
+        
+        store.removeWebSocket(connectionKey1);
+        verifyGet(store, connectionKey1, webSocket1, false);
+
+        store.removeWebSocket(webSocket2);
+        verifyGet(store, connectionKey2, webSocket2, false);
+        
+        assertEquals(0, store.getAllWebSockets().size());
+    }
+
+    private void verifyGet(MemoryWebSocketStore store, String ck, WebSocket ws, boolean exists) {
+        WebSocket aws = store.getWebSocket(ck);
+        String ack = store.getConnectionKey(ws);
+        if (exists) {
+            assertNotNull(aws);
+            assertEquals(ws, aws);
+            assertNotNull(ack);
+            assertEquals(ck, ack);
+        } else {
+            assertNull(aws);
+            assertNull(ack);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/TestClient.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/TestClient.java b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/TestClient.java
new file mode 100644
index 0000000..883e713
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/TestClient.java
@@ -0,0 +1,165 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.wsservlet;
+
+import com.ning.http.client.AsyncHttpClient;
+import com.ning.http.client.AsyncHttpClientConfig;
+import com.ning.http.client.websocket.WebSocket;
+import com.ning.http.client.websocket.WebSocketByteListener;
+import com.ning.http.client.websocket.WebSocketTextListener;
+import com.ning.http.client.websocket.WebSocketUpgradeHandler;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestClient {
+    private static final Logger LOG = LoggerFactory.getLogger(TestClient.class);
+    
+    private List<Object> received;
+    private CountDownLatch latch;
+    private AsyncHttpClient client;
+    private WebSocket websocket;
+    private String url;
+    
+    public TestClient(String url, AsyncHttpClientConfig conf) {
+        this(url, conf, 1);
+    }
+
+    public TestClient(String url, int count) {
+        this(url, null, count);
+    }
+
+    public TestClient(String url) {
+        this(url, null, 1);
+    }
+
+    public TestClient(String url, AsyncHttpClientConfig conf, int count) {
+        this.received = new ArrayList<Object>();
+        this.latch = new CountDownLatch(count);
+        this.client = conf == null ? new AsyncHttpClient() : new AsyncHttpClient(conf);
+        this.url = url;
+    }
+    
+    public void connect() throws InterruptedException, ExecutionException, IOException {
+        websocket = client.prepareGet(url).execute(
+            new WebSocketUpgradeHandler.Builder()
+            .addWebSocketListener(new TestWebSocketListener()).build()).get();
+    }
+
+    public void sendTextMessage(String message) {
+        websocket.sendTextMessage(message);
+    }
+
+    public void sendBytesMessage(byte[] message) {
+        websocket.sendMessage(message);
+    }
+
+    public boolean await(int secs) throws InterruptedException {
+        return latch.await(secs, TimeUnit.SECONDS);
+    }
+
+    public void reset(int count) {
+        latch = new CountDownLatch(count);
+        received.clear();
+    }
+
+    public List<Object> getReceived() {
+        return received;
+    }
+
+    public <T> List<T> getReceived(Class<T> cls) {
+        List<T> list = new ArrayList<T>();
+        for (Object o : received) {
+            list.add(getValue(o, cls));
+        }
+        return list;
+    }
+
+    @SuppressWarnings("unchecked")
+    private static <T> T getValue(Object o, Class<T> cls) {
+        if (cls.isInstance(o)) {
+            return (T)o;
+        } else if (cls == String.class) {
+            if (o instanceof byte[]) {
+                return (T)new String((byte[])o);
+            } else {
+                return (T)o.toString();
+            }
+        } else if (cls == byte[].class) {
+            if (o instanceof String) {
+                return (T)((String)o).getBytes();
+            }
+        }
+        return null;
+    }
+    
+    public void close() {
+        websocket.close();
+        client.close();
+    }
+
+    private class TestWebSocketListener implements WebSocketTextListener, WebSocketByteListener {
+
+        @Override
+        public void onOpen(WebSocket websocket) {
+            LOG.info("[ws] opened");
+        }
+
+        @Override
+        public void onClose(WebSocket websocket) {
+            LOG.info("[ws] closed");
+        }
+
+        @Override
+        public void onError(Throwable t) {
+            LOG.error("[ws] error", t);
+        }
+
+        @Override
+        public void onMessage(byte[] message) {
+            received.add(message);
+            LOG.info("[ws] received bytes --> " + message);
+            latch.countDown();
+        }
+
+        @Override
+        public void onFragment(byte[] fragment, boolean last) {
+            // TODO Auto-generated method stub
+        }
+
+        @Override
+        public void onMessage(String message) {
+            received.add(message);
+            LOG.info("[ws] received --> " + message);
+            latch.countDown();
+        }
+
+        @Override
+        public void onFragment(String fragment, boolean last) {
+            // TODO Auto-generated method stub
+        }
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketCamelRouterTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketCamelRouterTestSupport.java b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketCamelRouterTestSupport.java
new file mode 100644
index 0000000..42c752b
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketCamelRouterTestSupport.java
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.wsservlet;
+
+import org.apache.camel.component.atmosphere.websocket.CamelWebSocketServlet;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.nio.SelectChannelConnector;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.junit.After;
+import org.junit.Before;
+
+public class WebsocketCamelRouterTestSupport extends CamelTestSupport {
+    public static final String CONTEXT = "/mycontext";
+    public static final String CONTEXT_URL = "http://localhost/mycontext";
+    protected boolean startCamelContext = true;
+    protected int PORT = AvailablePortFinder.getNextAvailable();
+    protected Server server;
+
+    @Before
+    public void setUp() throws Exception {
+        server = new Server();
+        Connector connector = new SelectChannelConnector();
+        connector.setHost("localhost");
+        connector.setPort(PORT);
+        server.addConnector(connector);
+        
+        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
+        context.setContextPath("/");
+        server.setHandler(context);
+
+        ServletHolder servletHolder = new ServletHolder(new CamelWebSocketServlet());
+        servletHolder.setName("CamelWsServlet");
+        context.addServlet(servletHolder, "/*");
+        
+        server.start();
+        
+        if (startCamelContext) {        
+            super.setUp();
+        }
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        if (startCamelContext) {
+            super.tearDown();
+        }
+        
+        server.stop();
+        server.destroy();
+    }
+    
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketRouteTest.java b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketRouteTest.java
new file mode 100644
index 0000000..fe1a796
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/wsservlet/WebsocketRouteTest.java
@@ -0,0 +1,216 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.wsservlet;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class WebsocketRouteTest extends WebsocketCamelRouterTestSupport {
+    private static final String RESPONSE_GREETING = "Hola ";
+    private static final byte[] RESPONSE_GREETING_BYTES = {0x48, 0x6f, 0x6c, 0x61, 0x20};
+
+    @Test
+    public void testWebsocketSingleClient() throws Exception {
+        TestClient wsclient = new TestClient("ws://localhost:" + PORT + "/hola");
+        wsclient.connect();
+        
+        wsclient.sendTextMessage("Cerveza");
+        
+        assertTrue(wsclient.await(10));
+        List<String> received = wsclient.getReceived(String.class);
+        assertEquals(1, received.size());
+        assertEquals("Hola Cerveza", received.get(0));
+        wsclient.close();
+    }
+
+    @Test
+    public void testWebsocketSingleClientForBytes() throws Exception {
+        TestClient wsclient = new TestClient("ws://localhost:" + PORT + "/hola");
+        wsclient.connect();
+        
+        wsclient.sendBytesMessage("Cerveza".getBytes("UTF-8"));
+        
+        assertTrue(wsclient.await(10));
+        List<String> received = wsclient.getReceived(String.class);
+        assertEquals(1, received.size());
+        assertEquals("Hola Cerveza", received.get(0));
+        wsclient.close();
+    }
+
+    @Test
+    public void testWebsocketSingleClientForReader() throws Exception {
+        TestClient wsclient = new TestClient("ws://localhost:" + PORT + "/hola3");
+        wsclient.connect();
+        
+        wsclient.sendTextMessage("Cerveza");
+        
+        assertTrue(wsclient.await(10));
+        List<String> received = wsclient.getReceived(String.class);
+        assertEquals(1, received.size());
+        assertEquals("Hola Cerveza", received.get(0));
+        wsclient.close();
+    }
+
+    @Test
+    public void testWebsocketSingleClientForInputStream() throws Exception {
+        TestClient wsclient = new TestClient("ws://localhost:" + PORT + "/hola3");
+        wsclient.connect();
+        
+        wsclient.sendBytesMessage("Cerveza".getBytes("UTF-8"));
+        
+        assertTrue(wsclient.await(10));
+        List<String> received = wsclient.getReceived(String.class);
+        assertEquals(1, received.size());
+        assertEquals("Hola Cerveza", received.get(0));
+        wsclient.close();
+    }
+
+    @Test
+    public void testWebsocketBroadcastClient() throws Exception {
+        TestClient wsclient1 = new TestClient("ws://localhost:" + PORT + "/hola2", 2);
+        TestClient wsclient2 = new TestClient("ws://localhost:" + PORT + "/hola2", 2);
+        wsclient1.connect();
+        wsclient2.connect();
+        
+        wsclient1.sendTextMessage("Gambas");
+        wsclient2.sendTextMessage("Calamares");
+        
+        assertTrue(wsclient1.await(10));
+        assertTrue(wsclient2.await(10));
+        
+        List<String> received1 = wsclient1.getReceived(String.class);
+        assertEquals(2, received1.size());
+        
+        assertTrue(received1.contains("Hola Gambas"));
+        assertTrue(received1.contains("Hola Calamares"));
+
+        List<String> received2 = wsclient2.getReceived(String.class);
+        assertEquals(2, received2.size());
+        assertTrue(received2.contains("Hola Gambas"));
+        assertTrue(received2.contains("Hola Calamares"));
+
+        wsclient1.close();
+        wsclient2.close();
+    }
+
+    // START SNIPPET: payload
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                // route for a single line
+                from("atmosphere-websocket:///hola").to("log:info").process(new Processor() {
+                    public void process(final Exchange exchange) throws Exception {
+                        createResponse(exchange, false);
+                    }
+                }).to("atmosphere-websocket:///hola");
+
+                // route for a broadcast line
+                from("atmosphere-websocket:///hola2").to("log:info").process(new Processor() {
+                    public void process(final Exchange exchange) throws Exception {
+                        createResponse(exchange, false);
+                    }
+                }).to("atmosphere-websocket:///hola2?sendToAll=true");
+                
+                // route for a single stream line
+                from("atmosphere-websocket:///hola3?useStreaming=true").to("log:info").process(new Processor() {
+                    public void process(final Exchange exchange) throws Exception {
+                        createResponse(exchange, true);
+                    }
+                }).to("atmosphere-websocket:///hola3");
+                
+            }
+        };
+    }
+
+    private static void createResponse(Exchange exchange, boolean streaming) {
+        Object msg = exchange.getIn().getBody();
+        if (streaming) {
+            assertTrue("Expects Reader or InputStream", msg instanceof Reader || msg instanceof InputStream);
+        } else {
+            assertTrue("Expects String or byte[]", msg instanceof String || msg instanceof byte[]);
+        }
+        
+        if (msg instanceof String) {
+            exchange.getIn().setBody(RESPONSE_GREETING + msg);     
+        } else if (msg instanceof byte[]) {
+            exchange.getIn().setBody(createByteResponse((byte[])msg));
+        } else if (msg instanceof Reader) {
+            exchange.getIn().setBody(new StringReader(RESPONSE_GREETING + readAll((Reader)msg)));
+        } else if (msg instanceof InputStream) {
+            exchange.getIn().setBody(createByteResponse(readAll((InputStream)msg)));
+        }
+    }
+    
+    private static byte[] createByteResponse(byte[] req) {
+        byte[] resp = new byte[((byte[])req).length + RESPONSE_GREETING_BYTES.length];
+        System.arraycopy(RESPONSE_GREETING_BYTES, 0, resp, 0, RESPONSE_GREETING_BYTES.length);
+        System.arraycopy(req, 0, resp, RESPONSE_GREETING_BYTES.length, ((byte[])req).length);
+        return resp;
+    }
+
+    private static String readAll(Reader reader) {
+        StringBuffer strbuf = new StringBuffer();
+        try {
+            char[] buf = new char[4024];
+            int n;
+            while ((n = reader.read(buf, 0, buf.length)) > 0) {
+                strbuf.append(buf, 0, n);
+            }
+        } catch (IOException e) {
+            // ignore
+        } finally {
+            try {
+                reader.close();
+            } catch (IOException e) {
+                // ignore
+            }
+        }
+
+        return strbuf.toString();
+    }
+    
+    private static byte[] readAll(InputStream is) {
+        ByteArrayOutputStream bytebuf = new ByteArrayOutputStream();
+        try {
+            byte[] buf = new byte[4024];
+            int n;
+            while ((n = is.read(buf, 0, buf.length)) > 0) {
+                bytebuf.write(buf, 0, n);
+            }
+        } catch (IOException e) {
+            // ignore
+        } finally {
+            try {
+                is.close();
+            } catch (IOException e) {
+                // ignore
+            }
+        }
+
+        return bytebuf.toByteArray();
+    }
+    // END SNIPPET: payload
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/test/resources/log4j.properties b/components/camel-atmosphere-websocket/src/test/resources/log4j.properties
new file mode 100644
index 0000000..0c38599
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/test/resources/log4j.properties
@@ -0,0 +1,39 @@
+## ------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ------------------------------------------------------------------------
+
+#
+# The logging properties used for testing
+#
+log4j.rootLogger=INFO, file
+
+# uncomment the following line to turn on Camel debugging
+log4j.logger.org.apache.camel.component.wsservlet=INFO
+log4j.logger.org.atmosphere.cpr=INFO
+log4j.logger.com.ning.http.client=INFO
+log4j.logger.org.eclipse.jetty.websocket=INFO
+
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.file.file=target/camel-websocket2-test.log

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/components/camel-atmosphere-websocket/src/test/resources/org/apache/camel/component/atmosphere/websocket/web.xml
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/test/resources/org/apache/camel/component/atmosphere/websocket/web.xml b/components/camel-atmosphere-websocket/src/test/resources/org/apache/camel/component/atmosphere/websocket/web.xml
new file mode 100644
index 0000000..1c49574
--- /dev/null
+++ b/components/camel-atmosphere-websocket/src/test/resources/org/apache/camel/component/atmosphere/websocket/web.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app
+    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+    "http://java.sun.com/dtd/web-app_2_3.dtd">
+    
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<!-- START SNIPPET: web -->    
+<web-app>
+
+  <servlet>
+    <servlet-name>CamelWsServlet</servlet-name>
+    <display-name>Camel WebSocket Transport Servlet</display-name>
+    <servlet-class>org.apache.camel.component.atmosphere.websocket.CamelWebSocketServlet</servlet-class>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>CamelWsServlet</servlet-name>
+    <url-pattern>/services/*</url-pattern>
+  </servlet-mapping>
+
+</web-app>
+<!-- END SNIPPET: web -->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index c444acb..69511eb 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -54,6 +54,7 @@
     <asm-bundle-version>3.3.1_1</asm-bundle-version>
     <asm-version>3.3.1</asm-version>
     <aspectj-version>1.6.2</aspectj-version>
+    <atmosphere-version>2.1.0</atmosphere-version>
     <atomikos-transactions-version>3.9.2</atomikos-transactions-version>
     <avalon-bundle-version>4.3.1_1</avalon-bundle-version>
     <avalon-version>4.3.1</avalon-version>
@@ -536,6 +537,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-atmosphere-websocket</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-atom</artifactId>
         <version>${project.version}</version>
       </dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/c1e68146/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index e3ae785..c9907b6 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -79,6 +79,12 @@
     <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.java-apns/${java-apns-bundle-version}</bundle>
     <bundle>mvn:org.apache.camel/camel-apns/${project.version}</bundle>
   </feature>
+  <feature name='camel-atmosphere-websocket' version='${project.version}' resolver='(obr)' start-level='50'>
+    <feature version='${project.version}'>camel-core</feature>
+    <feature version='${project.version}'>camel-servlet</feature>
+    <bundle dependency='true'>mvn:org.atmosphere/atmosphere-runtime/${atmosphere-version}</bundle>
+    <bundle>mvn:org.apache.camel/camel-atmosphere-websocket/${project.version}</bundle>
+  </feature>
   <feature name='camel-atom' version='${project.version}' resolver='(obr)' start-level='50'>
     <feature version='${project.version}'>camel-core</feature>
     <bundle dependency='true'>mvn:javax.mail/mail/${javax-mail-version}</bundle>