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 C8B92200B8B for ; Tue, 30 Aug 2016 01:22:50 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C7540160ACA; Mon, 29 Aug 2016 23:22:50 +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 4BEB0160ACF for ; Tue, 30 Aug 2016 01:22:49 +0200 (CEST) Received: (qmail 93954 invoked by uid 500); 29 Aug 2016 23:22:47 -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 93240 invoked by uid 99); 29 Aug 2016 23:22:47 -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; Mon, 29 Aug 2016 23:22:47 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 49CE5E0551; Mon, 29 Aug 2016 23:22:47 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: reta@apache.org To: commits@cxf.apache.org Date: Mon, 29 Aug 2016 23:23:00 -0000 Message-Id: In-Reply-To: <4bcdd328ec84459e960aca78c47a9afc@git.apache.org> References: <4bcdd328ec84459e960aca78c47a9afc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [14/29] cxf git commit: Also removing the actual per-path swagger demo code archived-at: Mon, 29 Aug 2016 23:22:50 -0000 Also removing the actual per-path swagger demo code Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/59091dfe Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/59091dfe Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/59091dfe Branch: refs/heads/master-jaxrs-2.1 Commit: 59091dfee0d814228f49c84882983c8a60da7c5e Parents: 0635c04 Author: Sergey Beryozkin Authored: Mon Aug 29 13:11:13 2016 +0100 Committer: Sergey Beryozkin Committed: Mon Aug 29 13:11:13 2016 +0100 ---------------------------------------------------------------------- .../README.txt | 47 ------ .../pom.xml | 151 ------------------- .../jaxrs/swagger/server/ApiOriginFilter.java | 45 ------ .../java/demo/jaxrs/swagger/server/Item.java | 49 ------ .../java/demo/jaxrs/swagger/server/Server.java | 93 ------------ .../main/java/demo/jaxrs/swagger/v1/Sample.java | 141 ----------------- .../main/java/demo/jaxrs/swagger/v2/Sample.java | 140 ----------------- .../META-INF/cxf/org.apache.cxf.Logger | 1 - .../src/main/resources/logback.xml | 16 -- 9 files changed, 683 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/59091dfe/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/README.txt ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/README.txt b/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/README.txt deleted file mode 100644 index 89a4640..0000000 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/README.txt +++ /dev/null @@ -1,47 +0,0 @@ -JAX-RS Swagger2Feature Demo -================= - -The demo shows a basic usage of Swagger 2.0 API documentation with REST based Web Services using -JAX-RS 2.0 (JSR-339) and path-based configuration. Swagger UI is available at: http://localhost:9000/ - -There are two versions of the API deployed under /v1/ and /v2/ base paths. The demo project demonstrates -the usage of path-based configuration for properly publishing Swagger 2.0 API documentation. - -Building and running the demo using Maven ---------------------------------------- - -From the base directory of this sample (i.e., where this README file is -located), the Maven pom.xml file can be used to build and run the demo. - - -Using either UNIX or Windows: - - mvn install - mvn -Pserver (from one command line window) - - -After the service is started, the Swagger API documents in JSON and YAML -are available at - - http://localhost:9000/v1/swagger.json - http://localhost:9000/v1/swagger.yaml - - http://localhost:9000/v2/swagger.json - http://localhost:9000/v2/swagger.yaml - -To view the Swagger document using Swagger-UI, use your Browser to -open the Swagger-UI page at - - http://localhost:9000/v1?url=swagger.json - http://localhost:9000/v2?url=swagger.json - -or - - http://localhost:9000/v1?url=swagger.yaml - http://localhost:9000/v2?url=swagger.yaml - - -To remove the target dir, run mvn clean". - - - http://git-wip-us.apache.org/repos/asf/cxf/blob/59091dfe/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/pom.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/pom.xml b/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/pom.xml deleted file mode 100644 index c7f8932..0000000 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/pom.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - 4.0.0 - jax_rs_description_swagger2_per_path_config - JAX-RS Swagger2 Demo - JAX-RS Basic Demo - - org.apache.cxf.samples - cxf-samples - 3.2.0-SNAPSHOT - ../.. - - - - ${project.version} - 3.1 - - - - - server - - test - - - org.codehaus.mojo - exec-maven-plugin - - - test - - java - - - demo.jaxrs.swagger.server.Server - - - - - - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.9 - - - generate-resources - - unpack - - - - - org.webjars - swagger-ui - 2.1.0 - true - ${project.build.directory}/classes - - - - - - - - - - - - io.swagger - swagger-jaxrs - - - javax.ws.rs - jsr311-api - - - - - org.webjars - swagger-ui - 2.1.0 - provided - - - com.fasterxml.jackson.jaxrs - jackson-jaxrs-json-provider - - - com.fasterxml.jackson.core - jackson-core - - - org.apache.cxf - cxf-rt-transports-http - 3.2.0-SNAPSHOT - - - - org.apache.cxf - cxf-rt-transports-http-jetty - 3.2.0-SNAPSHOT - - - org.apache.cxf - cxf-rt-frontend-jaxrs - 3.2.0-SNAPSHOT - - - org.apache.cxf - cxf-rt-rs-service-description-swagger - 3.2.0-SNAPSHOT - - - commons-httpclient - commons-httpclient - - - javax.ws.rs - javax.ws.rs-api - - - org.eclipse.jetty - jetty-webapp - - - http://git-wip-us.apache.org/repos/asf/cxf/blob/59091dfe/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/server/ApiOriginFilter.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/server/ApiOriginFilter.java b/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/server/ApiOriginFilter.java deleted file mode 100644 index 43dd95d..0000000 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/server/ApiOriginFilter.java +++ /dev/null @@ -1,45 +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 demo.jaxrs.swagger.server; - -import java.io.IOException; - -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerResponseContext; -import javax.ws.rs.container.ContainerResponseFilter; -import javax.ws.rs.core.MultivaluedMap; - -/** - * This is a simple optional CORS filter used for this demo to make the resources accessible - * from other origins. You may omit using this filter or use CXF's advanced CORS filter - * org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter - * included in cxf-rt-rs-security-cors if you need a more comprehensive accessibility rules. - */ -public class ApiOriginFilter implements ContainerResponseFilter { - - @Override - public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) - throws IOException { - MultivaluedMap headers = responseContext.getHeaders(); - headers.add("Access-Control-Allow-Origin", "*"); - headers.add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - headers.add("Access-Control-Allow-Headers", "Content-Type"); - } -} http://git-wip-us.apache.org/repos/asf/cxf/blob/59091dfe/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/server/Item.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/server/Item.java b/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/server/Item.java deleted file mode 100644 index 1b5be9b..0000000 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/server/Item.java +++ /dev/null @@ -1,49 +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 demo.jaxrs.swagger.server; - -public class Item { - private String name; - private String value; - - public Item() { - } - - public Item(final String name, final String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} http://git-wip-us.apache.org/repos/asf/cxf/blob/59091dfe/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/server/Server.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/server/Server.java b/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/server/Server.java deleted file mode 100644 index b10ed6d..0000000 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/server/Server.java +++ /dev/null @@ -1,93 +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 demo.jaxrs.swagger.server; - -import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; - -import org.apache.commons.lang3.StringUtils; -import org.apache.cxf.jaxrs.provider.MultipartProvider; -import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet; -import org.apache.cxf.jaxrs.swagger.Swagger2Feature; -import org.eclipse.jetty.servlet.DefaultServlet; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; - -public class Server { - - protected Server() throws Exception { - org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(9000); - - // Configuring all static web resource - final ServletHolder staticHolder = new ServletHolder(new DefaultServlet()); - // Register and map the dispatcher servlet - final ServletContextHandler context = new ServletContextHandler(); - context.setContextPath("/"); - context.addServlet(staticHolder, "/*"); - context.setResourceBase( - getClass().getResource("/META-INF/resources/webjars/swagger-ui/2.1.0").toURI().toString()); - - final ServletHolder servletHolderV1 = new ServletHolder(new CXFNonSpringJaxrsServlet()); - context.addServlet(servletHolderV1, "/v1/*"); - servletHolderV1.setInitParameter("redirects-list", - "/ /index.html /.*[.]js /css/.* /images/.* lib/.* .*ico /fonts/.*"); - servletHolderV1.setInitParameter("redirect-servlet-name", staticHolder.getName()); - servletHolderV1.setInitParameter("redirect-attributes", "javax.servlet.include.request_uri"); - servletHolderV1.setInitParameter("jaxrs.serviceClasses", demo.jaxrs.swagger.v1.Sample.class.getName()); - servletHolderV1.setInitParameter("jaxrs.features", - Swagger2Feature.class.getName() + "(basePath=/v1 usePathBasedConfig=true)"); - servletHolderV1.setInitParameter("jaxrs.providers", StringUtils.join( - new String[] { - MultipartProvider.class.getName(), - JacksonJsonProvider.class.getName(), - ApiOriginFilter.class.getName() - }, ",") - ); - - final ServletHolder servletHolderV2 = new ServletHolder(new CXFNonSpringJaxrsServlet()); - context.addServlet(servletHolderV2, "/v2/*"); - servletHolderV2.setInitParameter("redirects-list", - "/ /index.html /.*[.]js /css/.* /images/.* lib/.* .*ico /fonts/.*"); - servletHolderV2.setInitParameter("redirect-servlet-name", staticHolder.getName()); - servletHolderV2.setInitParameter("redirect-attributes", "javax.servlet.include.request_uri"); - servletHolderV2.setInitParameter("jaxrs.serviceClasses", demo.jaxrs.swagger.v2.Sample.class.getName()); - servletHolderV2.setInitParameter("jaxrs.features", - Swagger2Feature.class.getName() + "(basePath=/v2 usePathBasedConfig=true)"); - servletHolderV2.setInitParameter("jaxrs.providers", StringUtils.join( - new String[] { - MultipartProvider.class.getName(), - JacksonJsonProvider.class.getName(), - ApiOriginFilter.class.getName() - }, ",") - ); - - server.setHandler(context); - server.start(); - server.join(); - } - - public static void main(String args[]) throws Exception { - new Server(); - System.out.println("Server ready..."); - - Thread.sleep(5 * 6000 * 1000); - System.out.println("Server exiting"); - System.exit(0); - } -} http://git-wip-us.apache.org/repos/asf/cxf/blob/59091dfe/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/v1/Sample.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/v1/Sample.java b/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/v1/Sample.java deleted file mode 100644 index a18cff2..0000000 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/v1/Sample.java +++ /dev/null @@ -1,141 +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 demo.jaxrs.swagger.v1; - -import java.util.Collections; -import java.util.Map; -import java.util.TreeMap; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.FormParam; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -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.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import demo.jaxrs.swagger.server.Item; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; - -@Path("/sample") -@Api(value = "/v1/sample", description = "Sample JAX-RS service with Swagger documentation") -public class Sample { - private Map items; - - public Sample() { - items = Collections.synchronizedMap(new TreeMap(String.CASE_INSENSITIVE_ORDER)); - items.put("Item 1", new Item("Item 1 (v1)", "Value 1")); - items.put("Item 2", new Item("Item 2 (v1)", "Value 2")); - } - - - @Produces({ MediaType.APPLICATION_JSON }) - @GET - @ApiOperation( - value = "Get operation with Response and @Default value", - notes = "Get operation with Response and @Default value", - response = Item.class, - responseContainer = "List" - ) - public Response getItems( - @ApiParam(value = "Page to fetch", required = true) @QueryParam("page") @DefaultValue("1") int page) { - - return Response.ok(items.values()).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 items.get(name); - } - - @Consumes({ MediaType.APPLICATION_JSON }) - @POST - @ApiOperation( - value = "Post operation with entity in a body", - notes = "Post operation with entity in a body", - response = Item.class - ) - public Response createItem( - @Context final UriInfo uriInfo, - @ApiParam(value = "item", required = true) final Item item) { - items.put(item.getName(), item); - return Response - .created(uriInfo.getBaseUriBuilder().path(item.getName()).build()) - .entity(item).build(); - } - - @Produces({ MediaType.APPLICATION_JSON }) - @Path("/{name}") - @PUT - @ApiOperation( - value = "Put operation with form parameter", - notes = "Put operation with form parameter", - response = Item.class - ) - public Item updateItem( - @ApiParam(value = "name", required = true) @PathParam("name") String name, - @ApiParam(value = "value", required = true) @FormParam("value") String value) { - Item item = new Item(name, value); - items.put(name, item); - return item; - } - - @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) { - items.remove(name); - return Response.ok().build(); - } -} http://git-wip-us.apache.org/repos/asf/cxf/blob/59091dfe/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/v2/Sample.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/v2/Sample.java b/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/v2/Sample.java deleted file mode 100644 index 36ddc02..0000000 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/java/demo/jaxrs/swagger/v2/Sample.java +++ /dev/null @@ -1,140 +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 demo.jaxrs.swagger.v2; - -import java.util.Collections; -import java.util.Map; -import java.util.TreeMap; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.FormParam; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -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.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import demo.jaxrs.swagger.server.Item; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; - -@Path("/sample") -@Api(value = "/v2/sample", description = "Sample JAX-RS service with Swagger documentation") -public class Sample { - private Map items; - - public Sample() { - items = Collections.synchronizedMap(new TreeMap(String.CASE_INSENSITIVE_ORDER)); - items.put("Item 1", new Item("Item 1 (v2)", "Value 1")); - items.put("Item 2", new Item("Item 2 (v2)", "Value 2")); - } - - @Produces({ MediaType.APPLICATION_JSON }) - @GET - @ApiOperation( - value = "Get operation with Response and @Default value", - notes = "Get operation with Response and @Default value", - response = Item.class, - responseContainer = "List" - ) - public Response getItems( - @ApiParam(value = "Page to fetch", required = true) @QueryParam("page") @DefaultValue("1") int page) { - - return Response.ok(items.values()).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 items.get(name); - } - - @Consumes({ MediaType.APPLICATION_JSON }) - @POST - @ApiOperation( - value = "Post operation with entity in a body", - notes = "Post operation with entity in a body", - response = Item.class - ) - public Response createItem( - @Context final UriInfo uriInfo, - @ApiParam(value = "item", required = true) final Item item) { - items.put(item.getName(), item); - return Response - .created(uriInfo.getBaseUriBuilder().path(item.getName()).build()) - .entity(item).build(); - } - - @Produces({ MediaType.APPLICATION_JSON }) - @Path("/{name}") - @PUT - @ApiOperation( - value = "Put operation with form parameter", - notes = "Put operation with form parameter", - response = Item.class - ) - public Item updateItem( - @ApiParam(value = "name", required = true) @PathParam("name") String name, - @ApiParam(value = "value", required = true) @FormParam("value") String value) { - Item item = new Item(name, value); - items.put(name, item); - return item; - } - - @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) { - items.remove(name); - return Response.ok().build(); - } -} http://git-wip-us.apache.org/repos/asf/cxf/blob/59091dfe/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/resources/META-INF/cxf/org.apache.cxf.Logger ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/resources/META-INF/cxf/org.apache.cxf.Logger b/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/resources/META-INF/cxf/org.apache.cxf.Logger deleted file mode 100644 index 27dd788..0000000 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/resources/META-INF/cxf/org.apache.cxf.Logger +++ /dev/null @@ -1 +0,0 @@ -org.apache.cxf.common.logging.Slf4jLogger \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf/blob/59091dfe/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/resources/logback.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/resources/logback.xml b/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/resources/logback.xml deleted file mode 100644 index 0a3e031..0000000 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2_per_path_config/src/main/resources/logback.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - [%level] %d{yyyy-MM-dd HH:mm:ss.SSS} %logger{36} - [%X] %msg%n - - - - - - - - - - - \ No newline at end of file