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/09/05 01:10:27 UTC

[20/23] cxf git commit: CXF-5855: Introduce support for Server Sent Events. Initial implementation based on Atmosphere

http://git-wip-us.apache.org/repos/asf/cxf/blob/cebe1153/distribution/src/main/release/samples/jax_rs/sse_spring/README.txt
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_spring/README.txt b/distribution/src/main/release/samples/jax_rs/sse_spring/README.txt
new file mode 100644
index 0000000..7a1901f
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_spring/README.txt
@@ -0,0 +1,35 @@
+JAX-RS SSE Demo 
+=================
+
+This is a SSE version of JAX-RS Basic Demo using Spring.
+
+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/cebe1153/distribution/src/main/release/samples/jax_rs/sse_spring/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_spring/pom.xml b/distribution/src/main/release/samples/jax_rs/sse_spring/pom.xml
new file mode 100644
index 0000000..fcab85d
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_spring/pom.xml
@@ -0,0 +1,142 @@
+<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_spring</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>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.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+        </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/cebe1153/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/Stats.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/Stats.java b/distribution/src/main/release/samples/jax_rs/sse_spring/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_spring/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/cebe1153/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsApplication.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsApplication.java b/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsApplication.java
new file mode 100644
index 0000000..6bfa2c8
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsApplication.java
@@ -0,0 +1,26 @@
+/**
+ * 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 javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+
+@ApplicationPath("api")
+public class StatsApplication extends Application {
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/cebe1153/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsConfig.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsConfig.java b/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsConfig.java
new file mode 100644
index 0000000..57a163f
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsConfig.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 javax.inject.Inject;
+import javax.ws.rs.ext.RuntimeDelegate;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+import org.apache.cxf.bus.spring.SpringBus;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.transport.sse.SseHttpTransportFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.DependsOn;
+
+@Configuration
+@ComponentScan(basePackageClasses = StatsRestServiceImpl.class)
+public class StatsConfig {
+    @Inject 
+    private StatsRestServiceImpl statsRestService;
+    
+    @Bean(destroyMethod = "shutdown")
+    SpringBus cxf() {
+        return new SpringBus();
+    }
+
+    @Bean @DependsOn("cxf")
+    Server jaxRsServer() {
+        final JAXRSServerFactoryBean factory = RuntimeDelegate
+            .getInstance()
+            .createEndpoint(new StatsApplication(), JAXRSServerFactoryBean.class);
+        factory.setServiceBean(statsRestService);
+        factory.setProvider(new JacksonJsonProvider());
+        factory.setTransportId(SseHttpTransportFactory.TRANSPORT_ID);
+        return factory.create();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/cebe1153/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java b/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
new file mode 100644
index 0000000..7112228
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
@@ -0,0 +1,83 @@
+/**
+ * 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;
+
+import org.springframework.stereotype.Component;
+
+@Path("/stats")
+@Component
+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/cebe1153/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsServer.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsServer.java b/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsServer.java
new file mode 100644
index 0000000..06a1e04
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/java/demo/jaxrs/sse/StatsServer.java
@@ -0,0 +1,63 @@
+/**
+ * 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.transport.servlet.CXFServlet;
+import org.apache.cxf.transport.sse.SseHttpTransportFactory;
+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.springframework.web.context.ContextLoaderListener;
+import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
+
+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 ServletHolder cxfServletHolder = new ServletHolder(new CXFServlet());
+        cxfServletHolder.setInitParameter(CXFServlet.TRANSPORT_ID, SseHttpTransportFactory.TRANSPORT_ID);
+        final ServletContextHandler context = new ServletContextHandler();
+        context.setContextPath("/");
+        context.addEventListener(new ContextLoaderListener());
+        context.addServlet(cxfServletHolder, "/rest/*");
+        context.setInitParameter("contextClass", AnnotationConfigWebApplicationContext.class.getName());
+        context.setInitParameter("contextConfigLocation", StatsConfig.class.getName());
+
+        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/cebe1153/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/resources/META-INF/beans.xml b/distribution/src/main/release/samples/jax_rs/sse_spring/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_spring/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/cebe1153/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/resources/META-INF/cxf/org.apache.cxf.Logger b/distribution/src/main/release/samples/jax_rs/sse_spring/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_spring/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/cebe1153/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/resources/log.properties
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/resources/log.properties b/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/resources/log.properties
new file mode 100644
index 0000000..d7336e2
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/resources/log.properties
@@ -0,0 +1,2 @@
+handlers=java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level=FINEST
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/cebe1153/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/resources/logback.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/resources/logback.xml b/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/resources/logback.xml
new file mode 100644
index 0000000..1052186
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_spring/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/cebe1153/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/resources/web-ui/index.html
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_spring/src/main/resources/web-ui/index.html b/distribution/src/main/release/samples/jax_rs/sse_spring/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_spring/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