Repository: cxf Updated Branches: refs/heads/3.0.x-fixes f56ef0eaf -> 8554177b3
add swagger2_spring sample and also fix the jackson dependency for cxf-3.1.6 (adjusted for 3.0.x) Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/8554177b Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8554177b Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8554177b Branch: refs/heads/3.0.x-fixes Commit: 8554177b382ddb90286862f43ac824ad481a5c57 Parents: f56ef0e Author: Akitoshi Yoshida <a...@apache.org> Authored: Tue Jun 7 09:45:13 2016 +0200 Committer: Akitoshi Yoshida <a...@apache.org> Committed: Tue Jun 7 10:02:01 2016 +0200 ---------------------------------------------------------------------- .../samples/jax_rs/description_swagger2/pom.xml | 10 -- .../jax_rs/description_swagger2_osgi/pom.xml | 10 -- .../description_swagger2_spring/README.txt | 42 ++++++ .../jax_rs/description_swagger2_spring/pom.xml | 113 +++++++++++++++ .../jaxrs/swagger/server/ApiOriginFilter.java | 45 ++++++ .../java/demo/jaxrs/swagger/server/Item.java | 49 +++++++ .../java/demo/jaxrs/swagger/server/Sample.java | 140 +++++++++++++++++++ .../java/demo/jaxrs/swagger/server/Server.java | 38 +++++ .../META-INF/cxf/org.apache.cxf.Logger | 1 + .../src/main/resources/context.xml | 63 +++++++++ .../src/main/resources/logback.xml | 16 +++ .../jax_rs/description_swagger2_web/pom.xml | 10 -- distribution/src/main/release/samples/pom.xml | 1 + 13 files changed, 508 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/8554177b/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml b/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml index 5b3e006..e3f7f55 100644 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml @@ -106,16 +106,6 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>com.fasterxml.jackson.jaxrs</groupId> - <artifactId>jackson-jaxrs-json-provider</artifactId> - <version>2.4.1</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - <version>2.4.1</version> - </dependency> - <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> <version>3.0.10-SNAPSHOT</version> http://git-wip-us.apache.org/repos/asf/cxf/blob/8554177b/distribution/src/main/release/samples/jax_rs/description_swagger2_osgi/pom.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_osgi/pom.xml b/distribution/src/main/release/samples/jax_rs/description_swagger2_osgi/pom.xml index 6471a8b..9fe4ac9 100644 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2_osgi/pom.xml +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_osgi/pom.xml @@ -75,16 +75,6 @@ under the License. </exclusions> </dependency> <dependency> - <groupId>com.fasterxml.jackson.jaxrs</groupId> - <artifactId>jackson-jaxrs-json-provider</artifactId> - <version>2.4.6</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - <version>2.4.6</version> - </dependency> - <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> <version>3.0.10-SNAPSHOT</version> http://git-wip-us.apache.org/repos/asf/cxf/blob/8554177b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/README.txt ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/README.txt b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/README.txt new file mode 100644 index 0000000..22c9bc3 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/README.txt @@ -0,0 +1,42 @@ +JAX-RS Swagger2Feature Spring 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). + +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/swaggerSample/swagger.json + http://localhost:9000/swaggerSample/swagger.yaml + +To remove the target dir, run mvn clean". + + +If you do not have your swagger-ui on your local system, you can download +a copy from its download site. + +At the console, type + + wget -N https://github.com/swagger-api/swagger-ui/archive/master.zip + unzip master.zip + +This will extract the content of the swagger-ui zip file. Using your Browser, open +the index.html file at swagger-ui-master/dist/. Finally, type in the above swagger +document URL in the input field and click on "Explore" to view the document. + + + http://git-wip-us.apache.org/repos/asf/cxf/blob/8554177b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/pom.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/pom.xml b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/pom.xml new file mode 100644 index 0000000..d7f5c66 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/pom.xml @@ -0,0 +1,113 @@ +<?xml version="1.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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>jax_rs_description_swagger2_spring</artifactId> + <name>JAX-RS Swagger2 Spring Demo</name> + <description>JAX-RS Basic Demo</description> + <parent> + <groupId>org.apache.cxf.samples</groupId> + <artifactId>cxf-samples</artifactId> + <version>3.0.10-SNAPSHOT</version> + <relativePath>../..</relativePath> + </parent> + + <properties> + <cxf.version>${project.version}</cxf.version> + <httpclient.version>3.1</httpclient.version> + </properties> + + <profiles> + <profile> + <id>server</id> + <build> + <defaultGoal>test</defaultGoal> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <phase>test</phase> + <goals> + <goal>java</goal> + </goals> + <configuration> + <mainClass>demo.jaxrs.swagger.server.Server</mainClass> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + + <dependencies> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-jaxrs</artifactId> + <exclusions> + <exclusion> + <groupId>javax.ws.rs</groupId> + <artifactId>jsr311-api</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-transports-http</artifactId> + <version>3.0.10-SNAPSHOT</version> + </dependency> + <!-- This dependency is needed if you're using the Jetty container --> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-transports-http-jetty</artifactId> + <version>3.0.10-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-frontend-jaxrs</artifactId> + <version>3.0.10-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-service-description</artifactId> + <version>3.0.10-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + </dependency> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + </dependency> + <!-- spring --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/cxf/blob/8554177b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/ApiOriginFilter.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/ApiOriginFilter.java b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/ApiOriginFilter.java new file mode 100644 index 0000000..43dd95d --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/ApiOriginFilter.java @@ -0,0 +1,45 @@ +/** + * 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<String, Object> 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/8554177b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/Item.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/Item.java b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/Item.java new file mode 100644 index 0000000..1b5be9b --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/Item.java @@ -0,0 +1,49 @@ +/** + * 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/8554177b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/Sample.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/Sample.java b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/Sample.java new file mode 100644 index 0000000..f3c1765 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/Sample.java @@ -0,0 +1,140 @@ +/** + * 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.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 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 = "/sample", description = "Sample JAX-RS service with Swagger documentation") +public class Sample { + private Map<String, Item> items; + + public Sample() { + items = Collections.synchronizedMap(new TreeMap<String, Item>(String.CASE_INSENSITIVE_ORDER)); + items.put("Item 1", new Item("Item 1", "Value 1")); + items.put("Item 2", new Item("Item 2", "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/8554177b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/Server.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/Server.java b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/Server.java new file mode 100644 index 0000000..d03938f --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/java/demo/jaxrs/swagger/server/Server.java @@ -0,0 +1,38 @@ +/** + * 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 org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class Server { + + + public static void main(String args[]) throws Exception { + ApplicationContext appctxt = + new ClassPathXmlApplicationContext(Server.class.getResource("/context.xml").toString()); + + 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/8554177b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/resources/META-INF/cxf/org.apache.cxf.Logger ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/resources/META-INF/cxf/org.apache.cxf.Logger b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/resources/META-INF/cxf/org.apache.cxf.Logger new file mode 100644 index 0000000..27dd788 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/resources/META-INF/cxf/org.apache.cxf.Logger @@ -0,0 +1 @@ +org.apache.cxf.common.logging.Slf4jLogger \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf/blob/8554177b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/resources/context.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/resources/context.xml b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/resources/context.xml new file mode 100644 index 0000000..474fb06 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/resources/context.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<!-- START SNIPPET: beans --> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://cxf.apache.org/core" + xmlns:jaxrs="http://cxf.apache.org/jaxrs" + xsi:schemaLocation="http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd + http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> + + <import resource="classpath:META-INF/cxf/cxf.xml" /> + + <!-- JAXRS providers --> + <bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" /> + <bean id="multipartProvider" class="org.apache.cxf.jaxrs.provider.MultipartProvider" /> + <bean id="originFilter" class="demo.jaxrs.swagger.server.ApiOriginFilter" /> + + <!-- Application resources --> + <bean id="sampleResource" class="demo.jaxrs.swagger.server.Sample" /> + + <!-- CXF Swagger2Feature --> + <bean id="swagger2Feature" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature"> + </bean> + + <cxf:bus> + <cxf:features> + <cxf:logging /> + </cxf:features> + </cxf:bus> + + <jaxrs:server id="sampleServer" address="http://localhost:9000/swaggerSample"> + <jaxrs:serviceBeans> + <ref bean="sampleResource" /> + </jaxrs:serviceBeans> + <jaxrs:providers> + <ref bean="jsonProvider" /> + <ref bean="multipartProvider" /> + <ref bean="originFilter" /> + </jaxrs:providers> + <jaxrs:features> + <ref bean="swagger2Feature" /> + </jaxrs:features> + </jaxrs:server> + +</beans> +<!-- END SNIPPET: beans --> http://git-wip-us.apache.org/repos/asf/cxf/blob/8554177b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/resources/logback.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/resources/logback.xml b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/resources/logback.xml new file mode 100644 index 0000000..0a3e031 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_spring/src/main/resources/logback.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration scan="true" scanPeriod="5 seconds"> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>[%level] %d{yyyy-MM-dd HH:mm:ss.SSS} %logger{36} - [%X] %msg%n</pattern> + </encoder> + </appender> + + <root level="INFO"> + <appender-ref ref="STDOUT" /> + </root> + + <logger category="com.wordnik.swagger" name="swagger"> + <level name="DEBUG"/> + </logger> +</configuration> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf/blob/8554177b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/pom.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/pom.xml b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/pom.xml index 96adeca..696e83f 100644 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/pom.xml +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/pom.xml @@ -125,16 +125,6 @@ under the License. <scope>provided</scope> </dependency> <dependency> - <groupId>com.fasterxml.jackson.jaxrs</groupId> - <artifactId>jackson-jaxrs-json-provider</artifactId> - <version>2.4.1</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - <version>2.4.1</version> - </dependency> - <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> <version>3.0.10-SNAPSHOT</version> http://git-wip-us.apache.org/repos/asf/cxf/blob/8554177b/distribution/src/main/release/samples/pom.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/pom.xml b/distribution/src/main/release/samples/pom.xml index 55fcc0a..d5f8c62 100644 --- a/distribution/src/main/release/samples/pom.xml +++ b/distribution/src/main/release/samples/pom.xml @@ -55,6 +55,7 @@ <module>jax_rs/description_swagger2</module> <module>jax_rs/description_swagger2_web</module> <module>jax_rs/description_swagger2_osgi</module> + <module>jax_rs/description_swagger2_spring</module> <module>callback</module> <module>wsdl_first_pure_xml</module> <module>jaxws_dispatch_provider</module>