cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6238] Updating ResponseStatus annotation to have a typed status array field
Date Thu, 05 Feb 2015 10:25:29 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 1d9e79ef3 -> d083c2023


[CXF-6238] Updating ResponseStatus annotation to have a typed status array field


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

Branch: refs/heads/master
Commit: d083c20235f22e03009ccfdc622cbfb8cb1b89c1
Parents: 1d9e79e
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Thu Feb 5 10:25:11 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Thu Feb 5 10:25:11 2015 +0000

----------------------------------------------------------------------
 .../src/main/java/org/apache/cxf/jaxrs/ext/ResponseStatus.java | 4 +++-
 .../java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java    | 6 +++---
 .../test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java   | 3 ++-
 3 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d083c202/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ResponseStatus.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ResponseStatus.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ResponseStatus.java
index 19dd4cc..dc1f8ed 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ResponseStatus.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ResponseStatus.java
@@ -23,9 +23,11 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
+import javax.ws.rs.core.Response;
+
 @Retention(RetentionPolicy.RUNTIME)
 @Target({ElementType.METHOD })
 public @interface ResponseStatus {
-    int[] value();
+    Response.Status[] value();
 }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/d083c202/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
index fd0946d..2d02e42 100644
--- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
+++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
@@ -584,7 +584,7 @@ public class WadlGenerator implements ContainerRequestFilter {
             setResponseStatus(sb, responseStatus.value());
         } else if (isVoid) {
             boolean oneway = getMethod(ori).getAnnotation(Oneway.class) != null;
-            setResponseStatus(sb, oneway ? 202 : 204);
+            setResponseStatus(sb, oneway ? Response.Status.ACCEPTED : Response.Status.NO_CONTENT);
         }
         sb.append(">");
         handleDocs(anns, sb, DocTarget.RESPONSE, false, isJson);
@@ -602,13 +602,13 @@ public class WadlGenerator implements ContainerRequestFilter {
         return resourceTagOpened;
     }
 
-    private void setResponseStatus(StringBuilder sb, int... statuses) {
+    private void setResponseStatus(StringBuilder sb, Response.Status... statuses) {
         sb.append(" status=\"");
         for (int i = 0; i < statuses.length; i++) {
             if (i > 0) {
                 sb.append(" ");
             }
-            sb.append(statuses[i]);
+            sb.append(statuses[i].getStatusCode());
         }
         sb.append("\"");
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/d083c202/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
b/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
index ceb5969..8ff129e 100644
--- a/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
+++ b/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
@@ -37,6 +37,7 @@ import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.cxf.aegis.type.java5.IgnoreProperty;
@@ -109,7 +110,7 @@ public class BookStore implements BookDescription {
         @Description(value = "Response", target = DocTarget.RESPONSE),
         @Description(value = "Resource books/{bookid}", target = DocTarget.RESOURCE)
     })
-    @ResponseStatus({201, 200 })
+    @ResponseStatus({Status.CREATED, Status.OK })
     //CHECKSTYLE:OFF
     @POST
     @Path("books/{bookid}")


Mime
View raw message