Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 906AD200B72 for ; Fri, 26 Aug 2016 22:50:55 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8ED8D160AB6; Fri, 26 Aug 2016 20:50:55 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AFD77160A94 for ; Fri, 26 Aug 2016 22:50:54 +0200 (CEST) Received: (qmail 85294 invoked by uid 500); 26 Aug 2016 20:50:53 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 85285 invoked by uid 99); 26 Aug 2016 20:50:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2016 20:50:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C8529E01BD; Fri, 26 Aug 2016 20:50:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: [CXF-7028] Making sure @Suspended can be inherited Date: Fri, 26 Aug 2016 20:50:53 +0000 (UTC) archived-at: Fri, 26 Aug 2016 20:50:55 -0000 Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 99f45aa1e -> 861541e23 [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/861541e2 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/861541e2 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/861541e2 Branch: refs/heads/3.1.x-fixes Commit: 861541e23d684f82f72c95d9610532bc1dc886d3 Parents: 99f45aa Author: Sergey Beryozkin Authored: Fri Aug 26 21:48:57 2016 +0100 Committer: Sergey Beryozkin Committed: Fri Aug 26 21:50:17 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/861541e2/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/861541e2/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/861541e2/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/861541e2/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 books = new HashMap(); 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 { } } + + }