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 2017/02/15 00:14:43 UTC

cxf git commit: Upgrading to JAX-RS 2.1-m04, updating SSE server-side implementation to accomodate API changes. Introducing SseContextProvider

Repository: cxf
Updated Branches:
  refs/heads/master f3bb66deb -> 9323b6856


Upgrading to JAX-RS 2.1-m04, updating SSE server-side implementation to accomodate API changes. Introducing SseContextProvider


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

Branch: refs/heads/master
Commit: 9323b68565ef79717e9d3e60744dd1bf63c1a5d8
Parents: f3bb66d
Author: reta <dr...@gmail.com>
Authored: Tue Feb 14 19:14:27 2017 -0500
Committer: reta <dr...@gmail.com>
Committed: Tue Feb 14 19:14:27 2017 -0500

----------------------------------------------------------------------
 .../demo/jaxrs/sse/StatsRestServiceImpl.java    |  4 +--
 .../demo/jaxrs/sse/StatsRestServiceImpl.java    |  4 +--
 .../demo/jaxrs/sse/StatsRestServiceImpl.java    |  4 +--
 .../cxf/jaxrs/sse/SseContextProvider.java       | 31 ++++++++++++++++++++
 .../org/apache/cxf/jaxrs/sse/SseFactory.java    | 27 -----------------
 .../org/apache/cxf/jaxrs/sse/SseFeature.java    |  1 +
 .../java/org/apache/cxf/jaxrs/sse/SseImpl.java  |  6 +++-
 .../apache/cxf/systest/jaxrs/sse/BookStore.java |  4 +--
 8 files changed, 45 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9323b685/distribution/src/main/release/samples/jax_rs/sse_cdi/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_cdi/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java b/distribution/src/main/release/samples/jax_rs/sse_cdi/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
index f1fa6a4..8c019af 100644
--- a/distribution/src/main/release/samples/jax_rs/sse_cdi/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
+++ b/distribution/src/main/release/samples/jax_rs/sse_cdi/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
@@ -33,12 +33,12 @@ import javax.ws.rs.sse.OutboundSseEvent.Builder;
 import javax.ws.rs.sse.Sse;
 import javax.ws.rs.sse.SseEventSink;
 
-import org.apache.cxf.jaxrs.sse.SseFactory;
+import org.apache.cxf.jaxrs.sse.SseImpl;
 
 @Path("/stats")
 public class StatsRestServiceImpl {
     private static final Random RANDOM = new Random();
-    private final Sse sse = SseFactory.create();
+    private final Sse sse = SseImpl.create();
 
     @GET
     @Path("sse/{id}")

http://git-wip-us.apache.org/repos/asf/cxf/blob/9323b685/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
index dc07af6..6ef7360 100644
--- 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
@@ -33,14 +33,14 @@ import javax.ws.rs.sse.OutboundSseEvent.Builder;
 import javax.ws.rs.sse.Sse;
 import javax.ws.rs.sse.SseEventSink;
 
-import org.apache.cxf.jaxrs.sse.SseFactory;
+import org.apache.cxf.jaxrs.sse.SseImpl;
 import org.springframework.stereotype.Component;
 
 @Path("/stats")
 @Component
 public class StatsRestServiceImpl {
     private static final Random RANDOM = new Random();
-    private final Sse sse = SseFactory.create();
+    private final Sse sse = SseImpl.create();
 
     @GET
     @Path("sse/{id}")

http://git-wip-us.apache.org/repos/asf/cxf/blob/9323b685/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
index f1fa6a4..8c019af 100644
--- a/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
+++ b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
@@ -33,12 +33,12 @@ import javax.ws.rs.sse.OutboundSseEvent.Builder;
 import javax.ws.rs.sse.Sse;
 import javax.ws.rs.sse.SseEventSink;
 
-import org.apache.cxf.jaxrs.sse.SseFactory;
+import org.apache.cxf.jaxrs.sse.SseImpl;
 
 @Path("/stats")
 public class StatsRestServiceImpl {
     private static final Random RANDOM = new Random();
-    private final Sse sse = SseFactory.create();
+    private final Sse sse = SseImpl.create();
 
     @GET
     @Path("sse/{id}")

http://git-wip-us.apache.org/repos/asf/cxf/blob/9323b685/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseContextProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseContextProvider.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseContextProvider.java
new file mode 100644
index 0000000..4fd80a4
--- /dev/null
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseContextProvider.java
@@ -0,0 +1,31 @@
+/**
+ * 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.cxf.jaxrs.sse;
+
+import javax.ws.rs.sse.Sse;
+
+import org.apache.cxf.jaxrs.ext.ContextProvider;
+import org.apache.cxf.message.Message;
+
+public class SseContextProvider implements ContextProvider<Sse> {
+    @Override
+    public Sse createContext(Message message) {
+        return new SseImpl();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/9323b685/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFactory.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFactory.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFactory.java
deleted file mode 100644
index 36a0e8e..0000000
--- a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFactory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * 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.cxf.jaxrs.sse;
-
-import javax.ws.rs.sse.Sse;
-
-public interface SseFactory {
-    static Sse create() {
-        return new SseImpl();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/9323b685/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFeature.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFeature.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFeature.java
index 2a381ea..7e3d75d 100644
--- a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFeature.java
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFeature.java
@@ -33,6 +33,7 @@ public class SseFeature extends AbstractFeature {
         final List<Object> providers = new ArrayList<>();
 
         providers.add(new SseAtmosphereEventSinkContextProvider());
+        providers.add(new SseContextProvider());
 
         ((ServerProviderFactory) server.getEndpoint().get(
             ServerProviderFactory.class.getName())).setUserProviders(providers);

http://git-wip-us.apache.org/repos/asf/cxf/blob/9323b685/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseImpl.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseImpl.java
index 17f6955..f3c6a79 100644
--- a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseImpl.java
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseImpl.java
@@ -22,9 +22,13 @@ import javax.ws.rs.sse.OutboundSseEvent.Builder;
 import javax.ws.rs.sse.Sse;
 import javax.ws.rs.sse.SseBroadcaster;
 
-class SseImpl implements Sse {
+public class SseImpl implements Sse {
     SseImpl() {
     }
+    
+    public static Sse create() {
+        return new SseImpl();
+    }
 
     @Override
     public Builder newEventBuilder() {

http://git-wip-us.apache.org/repos/asf/cxf/blob/9323b685/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java
----------------------------------------------------------------------
diff --git a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java
index f1c150c..4c07767 100644
--- a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java
+++ b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java
@@ -40,7 +40,7 @@ import javax.ws.rs.sse.Sse;
 import javax.ws.rs.sse.SseBroadcaster;
 import javax.ws.rs.sse.SseEventSink;
 
-import org.apache.cxf.jaxrs.sse.SseFactory;
+import org.apache.cxf.jaxrs.sse.SseImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -48,7 +48,7 @@ import org.slf4j.LoggerFactory;
 public class BookStore {
     private static final Logger LOG = LoggerFactory.getLogger(BookStore.class);
 
-    private final Sse sse = SseFactory.create();
+    private final Sse sse = SseImpl.create();
     private final CountDownLatch latch = new CountDownLatch(2);
     private final SseBroadcaster broadcaster;