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 2014/12/03 03:18:33 UTC
cxf git commit: CXF-6046: Enhance SwaggerFeature to support JAX-RS
annotations. Added more examples.
Repository: cxf
Updated Branches:
refs/heads/master a9555675b -> 652d82168
CXF-6046: Enhance SwaggerFeature to support JAX-RS annotations. Added more examples.
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/652d8216
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/652d8216
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/652d8216
Branch: refs/heads/master
Commit: 652d821683f12031258f7727d33157f3ab6ccbe6
Parents: a955567
Author: reta <dr...@gmail.com>
Authored: Tue Dec 2 21:17:38 2014 -0500
Committer: reta <dr...@gmail.com>
Committed: Tue Dec 2 21:17:38 2014 -0500
----------------------------------------------------------------------
.../java/demo/jaxrs/swagger/server/Sample.java | 40 +++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/652d8216/distribution/src/main/release/samples/jax_rs/description_swagger/src/main/java/demo/jaxrs/swagger/server/Sample.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger/src/main/java/demo/jaxrs/swagger/server/Sample.java b/distribution/src/main/release/samples/jax_rs/description_swagger/src/main/java/demo/jaxrs/swagger/server/Sample.java
index f39a4ca..ca92e7c 100644
--- a/distribution/src/main/release/samples/jax_rs/description_swagger/src/main/java/demo/jaxrs/swagger/server/Sample.java
+++ b/distribution/src/main/release/samples/jax_rs/description_swagger/src/main/java/demo/jaxrs/swagger/server/Sample.java
@@ -21,15 +21,20 @@ package demo.jaxrs.swagger.server;
import java.util.Arrays;
+import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiImplicitParam;
+import com.wordnik.swagger.annotations.ApiImplicitParams;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
@@ -44,7 +49,7 @@ public class Sample {
response = Item.class,
responseContainer = "List"
)
- public Response getResponse(
+ public Response getItems(
@ApiParam(value = "Page to fetch", required = true) @QueryParam("page") @DefaultValue("1") int page) {
return Response.ok(
Arrays.asList(
@@ -53,4 +58,37 @@ public class Sample {
)
).build();
}
+
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Path("/{name}")
+ @GET
+ @ApiOperation(
+ value = "Get operation with type and headers",
+ notes = "Get operation with type and headers",
+ response = Item.class
+ )
+ public Item getItem(
+ @ApiParam(value = "language", required = true) @HeaderParam("Accept-Language") final String language,
+ @ApiParam(value = "name", required = true) @PathParam("name") String name) {
+ return new Item("name", "Value in " + language);
+ }
+
+ @Path("/{name}")
+ @DELETE
+ @ApiOperation(
+ value = "Delete operation with implicit header",
+ notes = "Delete operation with implicit header"
+ )
+ @ApiImplicitParams(
+ @ApiImplicitParam(
+ name = "Accept-Language",
+ value = "language",
+ required = true,
+ dataType = "String",
+ paramType = "header"
+ )
+ )
+ public Response delete(@ApiParam(value = "name", required = true) @PathParam("name") String name) {
+ return Response.ok().build();
+ }
}