You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2016/05/31 00:37:07 UTC
[17/17] cxf git commit: CXF-5855: Introduce support for Server Sent
Events. Initial implementation based on Atmosphere
CXF-5855: Introduce support for Server Sent Events. Initial implementation based on Atmosphere
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/97d71d2c
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/97d71d2c
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/97d71d2c
Branch: refs/heads/master-jaxrs-2.1
Commit: 97d71d2c922fc50b5e2115344b9eaa70e7b0ed33
Parents: 3615f20
Author: reta <dr...@gmail.com>
Authored: Sun Apr 17 21:44:28 2016 -0400
Committer: reta <dr...@gmail.com>
Committed: Mon May 30 20:35:02 2016 -0400
----------------------------------------------------------------------
.../main/release/samples/jax_rs/sse/README.txt | 35 +++
.../src/main/release/samples/jax_rs/sse/pom.xml | 143 ++++++++++
.../sse/src/main/java/demo/jaxrs/sse/Stats.java | 56 ++++
.../java/demo/jaxrs/sse/StatsApplication.java | 44 +++
.../demo/jaxrs/sse/StatsRestServiceImpl.java | 80 ++++++
.../main/java/demo/jaxrs/sse/StatsServer.java | 62 +++++
.../src/main/resources/META-INF/atmosphere.xml | 6 +
.../sse/src/main/resources/META-INF/beans.xml | 10 +
.../META-INF/cxf/org.apache.cxf.Logger | 1 +
.../sse/src/main/resources/log.properties | 3 +
.../jax_rs/sse/src/main/resources/logback.xml | 16 ++
.../sse/src/main/resources/web-ui/index.html | 49 ++++
.../resources/web-ui/javascripts/highcharts.js | 270 +++++++++++++++++++
.../web-ui/javascripts/jquery-1.9.0.min.js | 4 +
.../samples/jax_rs/sse_tomcat/README.txt | 35 +++
.../release/samples/jax_rs/sse_tomcat/pom.xml | 167 ++++++++++++
.../src/main/java/demo/jaxrs/sse/Stats.java | 56 ++++
.../java/demo/jaxrs/sse/StatsApplication.java | 44 +++
.../demo/jaxrs/sse/StatsRestServiceImpl.java | 80 ++++++
.../main/java/demo/jaxrs/sse/StatsServer.java | 71 +++++
.../src/main/resources/META-INF/atmosphere.xml | 6 +
.../src/main/resources/META-INF/beans.xml | 10 +
.../src/main/resources/META-INF/context.xml | 6 +
.../META-INF/cxf/org.apache.cxf.Logger | 1 +
.../src/main/resources/log.properties | 3 +
.../sse_tomcat/src/main/resources/logback.xml | 16 ++
.../src/main/resources/web-ui/index.html | 49 ++++
.../resources/web-ui/javascripts/highcharts.js | 270 +++++++++++++++++++
.../web-ui/javascripts/jquery-1.9.0.min.js | 4 +
distribution/src/main/release/samples/pom.xml | 2 +
parent/pom.xml | 17 +-
rt/rs/pom.xml | 1 +
rt/rs/sse/pom.xml | 70 +++++
.../jaxrs/sse/OutboundSseEventBodyWriter.java | 139 ++++++++++
.../cxf/jaxrs/sse/OutboundSseEventImpl.java | 171 ++++++++++++
.../cxf/jaxrs/sse/SseBroadcasterImpl.java | 65 +++++
.../cxf/jaxrs/sse/SseEventOutputProvider.java | 53 ++++
.../org/apache/cxf/jaxrs/sse/SseFeature.java | 41 +++
.../SseAtmosphereContextProvider.java | 57 ++++
.../SseAtmosphereEventOutputImpl.java | 111 ++++++++
.../atmosphere/SseAtmosphereInterceptor.java | 180 +++++++++++++
.../SseAtmosphereInterceptorWriter.java | 30 +++
.../SseAtmosphereResourceContext.java | 60 +++++
.../cxf/jaxrs/sse/servlet/CXFSseServlet.java | 41 +++
44 files changed, 2634 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/97d71d2c/distribution/src/main/release/samples/jax_rs/sse/README.txt
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/README.txt b/distribution/src/main/release/samples/jax_rs/sse/README.txt
new file mode 100644
index 0000000..bc73a45
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/README.txt
@@ -0,0 +1,35 @@
+JAX-RS SSE Demo
+=================
+
+This is a SSE version of JAX-RS Basic Demo.
+
+A SSE endpoint service is provided on URL http://localhost:8686/rest/api/stats/sse/{id}
+where {id} is any integer value, f.e.:
+
+ http://localhost:8686/rest/api/stats/sse/1
+
+This sample includes a simple web UI using Highcharts JavaScript library to show off
+randomly generated statistics about particular server, pushed to the client using
+SSE JAX-RS endpoint. The UI is available at
+
+ http://localhost:8686/static/
+
+Under the hood, embedded Jetty 9 container is being used.
+
+Building and running the demo using maven
+---------------------------------------
+
+From the base directory of this sample (i.e., where this README file is
+located), the maven pom.xml file can be used to build and run the demo.
+
+Using either UNIX or Windows:
+
+ mvn install
+ mvn -Pserver
+
+To remove the target dir, run mvn clean".
+
+Connecting to the SSE stream
+---------------------------------------
+
+Open a web browser at: http://localhost:8686/static/
http://git-wip-us.apache.org/repos/asf/cxf/blob/97d71d2c/distribution/src/main/release/samples/jax_rs/sse/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/pom.xml b/distribution/src/main/release/samples/jax_rs/sse/pom.xml
new file mode 100644
index 0000000..58f11bd
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/pom.xml
@@ -0,0 +1,143 @@
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>JAX-RS SSE Demo (Jetty 9)</name>
+ <description>JAX-RS SSE Demo (Jetty 9)</description>
+ <artifactId>jax_rs_sse</artifactId>
+
+ <parent>
+ <groupId>org.apache.cxf.samples</groupId>
+ <artifactId>cxf-samples</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <cxf.jetty9.version>9.3.5.v20151012</cxf.jetty9.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-integration-cdi</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-sse</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-json-provider</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.weld.servlet</groupId>
+ <artifactId>weld-servlet</artifactId>
+ <version>2.2.16.Final</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ <version>2.2.16.Final</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-plus</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>apache-jsp</artifactId>
+ <version>${cxf.jetty9.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty.websocket</groupId>
+ <artifactId>websocket-server</artifactId>
+ <version>${cxf.jetty9.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.atmosphere</groupId>
+ <artifactId>atmosphere-runtime</artifactId>
+ <version>2.4.3</version>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>server</id>
+ <build>
+ <defaultGoal>test</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+ <mainClass>demo.jaxrs.sse.StatsServer</mainClass>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/cxf/blob/97d71d2c/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/Stats.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/Stats.java b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/Stats.java
new file mode 100644
index 0000000..874047c
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/Stats.java
@@ -0,0 +1,56 @@
+/**
+ * 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 demo.jaxrs.sse;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(value = Include.NON_NULL)
+public class Stats implements Serializable {
+ private static final long serialVersionUID = -6705829915457870975L;
+
+ private long timestamp;
+ private int load;
+
+ public Stats() {
+ }
+
+ public Stats(long timestamp, int load) {
+ this.timestamp = timestamp;
+ this.load = load;
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public int getLoad() {
+ return load;
+ }
+
+ public void setLoad(int load) {
+ this.load = load;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/97d71d2c/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/StatsApplication.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/StatsApplication.java b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/StatsApplication.java
new file mode 100644
index 0000000..edf8a2b
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/StatsApplication.java
@@ -0,0 +1,44 @@
+/**
+ * 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 demo.jaxrs.sse;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+import org.apache.cxf.jaxrs.sse.SseFeature;
+
+@ApplicationPath("api")
+public class StatsApplication extends Application {
+ @Inject private StatsRestServiceImpl statsRestService;
+
+ @Override
+ public Set<Object> getSingletons() {
+ final Set<Object> singletons = new HashSet<>();
+ singletons.add(new SseFeature());
+ singletons.add(statsRestService);
+ singletons.add(new JacksonJsonProvider());
+ return singletons;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/97d71d2c/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
new file mode 100644
index 0000000..b8f8608
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
@@ -0,0 +1,80 @@
+/**
+ * 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 demo.jaxrs.sse;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.Random;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.sse.OutboundSseEvent;
+import javax.ws.rs.sse.SseContext;
+import javax.ws.rs.sse.SseEventOutput;
+
+@Path("/stats")
+public class StatsRestServiceImpl {
+ private static final Random RANDOM = new Random();
+
+ private static OutboundSseEvent createStatsEvent(final OutboundSseEvent.Builder builder, final int eventId) {
+ return builder
+ .id("" + eventId)
+ .data(Stats.class, new Stats(new Date().getTime(), RANDOM.nextInt(100)))
+ .mediaType(MediaType.APPLICATION_JSON_TYPE)
+ .build();
+ }
+
+ @GET
+ @Path("sse/{id}")
+ @Produces("text/event-stream")
+ public SseEventOutput stats(@Context SseContext sseContext, @PathParam("id") final String id) {
+ final SseEventOutput output = sseContext.newOutput();
+
+ new Thread() {
+ public void run() {
+ try {
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 1));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 2));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 3));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 4));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 5));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 6));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 7));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 8));
+ output.close();
+ } catch (final InterruptedException | IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }.start();
+
+ return output;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/97d71d2c/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/StatsServer.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/StatsServer.java b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/StatsServer.java
new file mode 100644
index 0000000..947e1c5
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/java/demo/jaxrs/sse/StatsServer.java
@@ -0,0 +1,62 @@
+/**
+ * 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 demo.jaxrs.sse;
+
+import org.apache.cxf.cdi.CXFCdiServlet;
+import org.apache.cxf.jaxrs.sse.servlet.CXFSseServlet;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.HandlerList;
+import org.eclipse.jetty.servlet.DefaultServlet;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.jboss.weld.environment.servlet.BeanManagerResourceBindingListener;
+import org.jboss.weld.environment.servlet.Listener;
+
+public final class StatsServer {
+ private StatsServer() {
+ }
+
+ public static void main(final String[] args) throws Exception {
+ final Server server = new Server(8686);
+
+ final ServletHolder staticHolder = new ServletHolder(new DefaultServlet());
+ final ServletContextHandler staticContext = new ServletContextHandler();
+ staticContext.setContextPath("/static");
+ staticContext.addServlet(staticHolder, "/*");
+ staticContext.setResourceBase(StatsServer.class.getResource("/web-ui").toURI().toString());
+
+ // Register and map the dispatcher servlet
+ final CXFSseServlet cxfServlet = new CXFSseServlet(new CXFCdiServlet());
+ final ServletHolder cxfServletHolder = new ServletHolder(cxfServlet);
+ final ServletContextHandler context = new ServletContextHandler();
+ context.setContextPath("/");
+ context.addEventListener(new Listener());
+ context.addEventListener(new BeanManagerResourceBindingListener());
+ context.addServlet(cxfServletHolder, "/rest/*");
+
+ HandlerList handlers = new HandlerList();
+ handlers.addHandler(staticContext);
+ handlers.addHandler(context);
+
+ server.setHandler(handlers);
+ server.start();
+ server.join();
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/cxf/blob/97d71d2c/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/atmosphere.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/atmosphere.xml b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/atmosphere.xml
new file mode 100644
index 0000000..9fc1344
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/atmosphere.xml
@@ -0,0 +1,6 @@
+<atmosphere-handlers>
+ <!-- CXF -->
+ <atmosphere-handler support-session="false" context-root="/*" class-name="org.atmosphere.handler.ReflectorServletProcessor">
+ <property name="servletClassName" value="org.apache.cxf.cdi.CXFCdiServlet"/>
+ </atmosphere-handler>
+</atmosphere-handlers>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf/blob/97d71d2c/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/beans.xml b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..7e2559b
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_1.xsd"
+ version="1.1">
+
+ <scan>
+ <exclude name="org.apache.cxf.**" />
+ </scan>
+</beans>
http://git-wip-us.apache.org/repos/asf/cxf/blob/97d71d2c/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/cxf/org.apache.cxf.Logger b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
new file mode 100644
index 0000000..27dd788
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
@@ -0,0 +1 @@
+org.apache.cxf.common.logging.Slf4jLogger
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf/blob/97d71d2c/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/log.properties
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/log.properties b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/log.properties
new file mode 100644
index 0000000..63477d3
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/log.properties
@@ -0,0 +1,3 @@
+handlers=java.util.logging.ConsoleHandler
+org.jboss.weld.level=FINEST
+java.util.logging.ConsoleHandler.level=FINEST
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf/blob/97d71d2c/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/logback.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/logback.xml b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/logback.xml
new file mode 100644
index 0000000..1052186
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/logback.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration scan="true" scanPeriod="5 seconds">
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>[%level] %d{yyyy-MM-dd HH:mm:ss.SSS} %logger{36} - [%X] %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <root level="DEBUG">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+ <logger category="org.jboss.weld">
+ <level name="DEBUG"/>
+ </logger>
+</configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf/blob/97d71d2c/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/index.html
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/index.html b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/index.html
new file mode 100644
index 0000000..2aaed6e
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse/src/main/resources/web-ui/index.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>SSE: Apache CXF example</title>
+ <script src="javascripts/jquery-1.9.0.min.js" type="text/javascript"></script>
+ <script src="javascripts/highcharts.js" type="text/javascript"></script>
+ </head>
+
+ <body>
+ <div id="content">
+ <div id="chart">
+ </div>
+ </div>
+ </body>
+</html>
+
+<script type="text/javascript">
+ var chart = new Highcharts.Chart({
+ chart: {
+ renderTo: 'chart',
+ defaultSeriesType: 'spline'
+ },
+ xAxis: {
+ type: 'datetime'
+ },
+ series: [{
+ name: "CPU",
+ data: []
+ }
+ ]
+ });
+
+ if( !!window.EventSource ) {
+ var event = new EventSource("http://localhost:8686/rest/api/stats/sse/1");
+
+ event.addEventListener('message', function( event ) {
+ var datapoint = jQuery.parseJSON( event.data );
+
+ chart.series[ 0 ].addPoint({
+ x: datapoint.timestamp,
+ y: datapoint.load
+ }, true, chart.series[ 0 ].data.length >= 50 );
+ } );
+
+ $('#content').bind('unload',function() {
+ event.close();
+ });
+ }
+</script>
\ No newline at end of file