cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [08/29] cxf git commit: [CXF-7028] Making sure @Suspended can be inherited
Date Mon, 29 Aug 2016 23:22:54 GMT
[CXF-7028] Making sure @Suspended can be inherited


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

Branch: refs/heads/master-jaxrs-2.1
Commit: bf63cc15c0d75bd57dd9e7316485127c32ca2ac0
Parents: 14c37ee
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Fri Aug 26 21:48:57 2016 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Fri Aug 26 21:48:57 2016 +0100

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/utils/ResourceUtils.java   |  2 +-
 .../jaxrs/AbstractJAXRSContinuationsTest.java   |  8 +++++
 .../cxf/systest/jaxrs/BookAsyncInterface.java   | 33 ++++++++++++++++++++
 .../systest/jaxrs/BookContinuationStore.java    | 11 +++++--
 4 files changed, 51 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/bf63cc15/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
index 28f09ad..afc759a 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
@@ -306,7 +306,7 @@ public final class ResourceUtils {
             Path path = AnnotationUtils.getMethodAnnotation(annotatedMethod, Path.class);
             
             if (httpMethod != null || path != null) {
-                if (!checkAsyncResponse(m)) {
+                if (!checkAsyncResponse(annotatedMethod)) {
                     continue;
                 }
                 

http://git-wip-us.apache.org/repos/asf/cxf/blob/bf63cc15/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
index 69ae0d7..13ef428 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
@@ -63,6 +63,14 @@ public abstract class AbstractJAXRSContinuationsTest extends AbstractBusClientSe
         Response r = wc.get(Response.class);
         assertEquals(204, r.getStatus());
     }
+    @Test
+    public void testCustomStatusFromInterface() throws Exception {
+        WebClient wc = WebClient.create("http://localhost:" + getPort() + getBaseAddress()

+            + "/books/async/nocontentInterface");
+        wc.accept("text/plain");
+        Response r = wc.get(Response.class);
+        assertEquals(206, r.getStatus());
+    }
     
     @Test
     public void testUnmappedAfterTimeout() throws Exception {

http://git-wip-us.apache.org/repos/asf/cxf/blob/bf63cc15/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookAsyncInterface.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookAsyncInterface.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookAsyncInterface.java
new file mode 100644
index 0000000..8bc9d95
--- /dev/null
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookAsyncInterface.java
@@ -0,0 +1,33 @@
+/**
+ * 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.systest.jaxrs;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.AsyncResponse;
+import javax.ws.rs.container.Suspended;
+
+public interface BookAsyncInterface {
+    @GET
+    @Path("/books/async/nocontentInterface")
+    @Produces("text/plain")
+    void getBookNoContentInterface(@Suspended AsyncResponse async);
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/bf63cc15/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationStore.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationStore.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationStore.java
index bdcdd1b..ceda589 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationStore.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationStore.java
@@ -44,7 +44,7 @@ import javax.ws.rs.core.Response;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 
 @Path("/bookstore")
-public class BookContinuationStore {
+public class BookContinuationStore implements BookAsyncInterface {
 
     private Map<String, String> books = new HashMap<String, String>();
     private Executor executor = new ThreadPoolExecutor(5, 5, 0, TimeUnit.SECONDS,
@@ -71,10 +71,15 @@ public class BookContinuationStore {
     @GET
     @Path("/books/nocontent")
     @Produces("text/plain")
-    public void getBookNoContent(@Suspended AsyncResponse async) {
+    public void getBookNoContent(AsyncResponse async) {
         async.resume(null);
     }
     
+
+    public void getBookNoContentInterface(@Suspended AsyncResponse async) {
+        async.resume(Response.status(206).build());
+    }
+    
     @GET
     @Path("/books/cancel")
     public void getBookDescriptionWithCancel(@PathParam("id") String id, 
@@ -280,6 +285,8 @@ public class BookContinuationStore {
         }
         
     }
+    
+    
 }
 
 


Mime
View raw message