cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [4/4] cxf git commit: [CXF-6530] Add a webapp version of Swagger2Feature sample using spring
Date Wed, 12 Aug 2015 10:50:28 GMT
[CXF-6530] Add a webapp version of Swagger2Feature sample using spring


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

Branch: refs/heads/3.0.x-fixes
Commit: c887ba7a8892e254ceb131ac988c34223aa11237
Parents: 21c40dc
Author: Akitoshi Yoshida <ay@apache.org>
Authored: Wed Aug 12 12:43:10 2015 +0200
Committer: Akitoshi Yoshida <ay@apache.org>
Committed: Wed Aug 12 12:49:20 2015 +0200

----------------------------------------------------------------------
 .../jax_rs/description_swagger2_web/README.txt  |  24 +++
 .../jax_rs/description_swagger2_web/pom.xml     | 179 +++++++++++++++++++
 .../java/demo/jaxrs/swagger/server/Item.java    |  49 +++++
 .../java/demo/jaxrs/swagger/server/Sample.java  | 130 ++++++++++++++
 .../src/main/webapp/WEB-INF/context.xml         |  62 +++++++
 .../src/main/webapp/WEB-INF/web.xml             |  41 +++++
 .../src/main/webapp/index.html                  |  84 +++++++++
 distribution/src/main/release/samples/pom.xml   |   1 +
 8 files changed, 570 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c887ba7a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/README.txt
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/README.txt
b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/README.txt
new file mode 100644
index 0000000..7ecb9f2
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/README.txt
@@ -0,0 +1,24 @@
+JAX-RS Swagger2Feature Demo using WebApp with Spring
+=================
+
+The demo shows a basic usage of Swagger API documentation with REST based Web Services using

+JAX-RS 2.0 (JSR-339). In this demo, the Swagger2Feature is configured using Spring.
+Swagger UI is available at: http://localhost:9000/
+
+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 package tomcat7:run  (from one command line window)  
+
+
+To remove the target dir, run mvn clean".
+
+
+

http://git-wip-us.apache.org/repos/asf/cxf/blob/c887ba7a/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
new file mode 100644
index 0000000..7a19507
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/pom.xml
@@ -0,0 +1,179 @@
+<?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_web</artifactId>
+    <packaging>war</packaging>
+    <name>JAX-RS Swagger2 WebApp Demo</name>
+    <description>JAX-RS Basic Demo</description>
+    <parent>
+        <groupId>org.apache.cxf.samples</groupId>
+        <artifactId>cxf-samples</artifactId>
+        <version>3.1.3-SNAPSHOT</version>
+        <relativePath>../..</relativePath>
+    </parent>
+
+    <properties>
+        <cxf.version>${project.version}</cxf.version>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>2.9</version>
+                <executions>
+                    <execution>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.webjars</groupId>
+                                    <artifactId>swagger-ui</artifactId>
+                                    <version>2.1.0</version>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${project.build.directory}/swagger-ui</outputDirectory>
+                                    <excludes>**/*.gz</excludes>            
                       
+                                </artifactItem>                                
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <version>2.6</version>
+                <executions>
+                    <execution>
+                        <id>copy-resources</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/2.1.0</directory>
+                                    <filtering>true</filtering>
+                                    <excludes>
+                                        <exclude>index.html</exclude>
+                                    </excludes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.tomcat.maven</groupId>
+                <artifactId>tomcat7-maven-plugin</artifactId>
+                <version>2.1</version>
+                <configuration>
+                    <warSourceDirectory>${project.build.directory}/${project.artifactId}-${project.version}</warSourceDirectory>
+                    <port>9000</port>
+                    <path>/</path>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>run-tomcat</id>
+                        <configuration>
+                            <fork>true</fork>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    
+    <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.webjars</groupId>
+            <artifactId>swagger-ui</artifactId>
+            <version>2.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javassist</groupId>
+            <artifactId>javassist</artifactId>
+            <version>3.12.1.GA</version>
+        </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.1.3-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+            <version>3.1.3-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-service-description</artifactId>
+            <version>3.1.3-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</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/c887ba7a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/java/demo/jaxrs/swagger/server/Item.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/java/demo/jaxrs/swagger/server/Item.java
b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/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_web/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/c887ba7a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/java/demo/jaxrs/swagger/server/Sample.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/java/demo/jaxrs/swagger/server/Sample.java
b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/java/demo/jaxrs/swagger/server/Sample.java
new file mode 100644
index 0000000..56d3213
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/java/demo/jaxrs/swagger/server/Sample.java
@@ -0,0 +1,130 @@
+/**
+ * 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.Arrays;
+
+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 {
+    @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(
+            Arrays.asList(
+                new Item("Item 1", "Value 1"),
+                new Item("Item 2", "Value 2")
+            )
+        ).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);
+    }
+    
+    @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) {
+        
+        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) { 
      
+        return new Item(name, value);
+    }
+    
+    @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();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/c887ba7a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/webapp/WEB-INF/context.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/webapp/WEB-INF/context.xml
b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/webapp/WEB-INF/context.xml
new file mode 100644
index 0000000..7adc4ad
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/webapp/WEB-INF/context.xml
@@ -0,0 +1,62 @@
+<?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"
/>
+
+    <!-- Application resources -->
+    <bean id="sampleResource" class="demo.jaxrs.swagger.server.Sample" />
+
+    <!-- CXF Swagger2Feature -->  
+    <bean id="swagger2Feature" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
+        <property name="basePath" value="/app"/>
+    </bean>
+
+    <cxf:bus>
+        <cxf:features>
+            <cxf:logging />
+        </cxf:features>
+    </cxf:bus>
+
+    <jaxrs:server id="sampleServer" address="/">
+        <jaxrs:serviceBeans>
+            <ref bean="sampleResource" />
+        </jaxrs:serviceBeans>
+        <jaxrs:providers>
+            <ref bean="jsonProvider" />
+            <ref bean="multipartProvider" />
+        </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/c887ba7a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/webapp/WEB-INF/web.xml
b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..942887a
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    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.
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
version="3.0"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+    <display-name>CXF Swagger2 Spring Sample</display-name>
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>WEB-INF/context.xml</param-value>
+    </context-param>
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
+    <servlet>
+        <display-name>CXF Service Servlet</display-name>
+        <servlet-name>CXFServiceServlet</servlet-name>
+        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>CXFServiceServlet</servlet-name>
+        <url-pattern>/app/*</url-pattern>
+    </servlet-mapping>
+</web-app>

http://git-wip-us.apache.org/repos/asf/cxf/blob/c887ba7a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/webapp/index.html
b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/webapp/index.html
new file mode 100644
index 0000000..19d5cf2
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/description_swagger2_web/src/main/webapp/index.html
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<html>
+<!-- This page is generated from swagger-ui-2.1.0/index.html.gz -->
+<head>
+  <title>Swagger UI + JAX-RS demo</title>
+  <link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
+  <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
+  <link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
+  <link href='css/print.css' media='print' rel='stylesheet' type='text/css'/>
+  <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
+  <script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
+  <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
+  <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
+  <script src='lib/handlebars-2.0.0.js' type='text/javascript'></script>
+  <script src='lib/underscore-min.js' type='text/javascript'></script>
+  <script src='lib/backbone-min.js' type='text/javascript'></script>
+  <script src='swagger-ui.js' type='text/javascript'></script>
+  <script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
+  <script src='lib/marked.js' type='text/javascript'></script>
+  <script src='lib/swagger-oauth.js' type='text/javascript'></script>
+
+  <script type="text/javascript">
+    $(function () {
+      var url = "/app/swagger.json";
+      window.swaggerUi = new SwaggerUi({
+        url: url,
+        dom_id: "swagger-ui-container",
+        supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
+        onComplete: function(swaggerApi, swaggerUi){
+          if(typeof initOAuth == "function") {
+            initOAuth({
+              clientId: "your-client-id",
+              realm: "your-realms",
+              appName: "your-app-name"
+            });
+          }
+
+          $('pre code').each(function(i, e) {
+            hljs.highlightBlock(e)
+          });
+
+          addApiKeyAuthorization();
+        },
+        onFailure: function(data) {
+          log("Unable to Load SwaggerUI");
+        },
+        docExpansion: "none",
+        apisSorter: "alpha",
+        showRequestHeaders: false
+      });
+
+      function addApiKeyAuthorization(){
+        var key = encodeURIComponent($('#input_apiKey')[0].value);
+        if(key && key.trim() != "") {
+            var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("api_key", key, "query");
+            window.swaggerUi.api.clientAuthorizations.add("api_key", apiKeyAuth);
+            log("added key " + key);
+        }
+      }
+
+      $('#input_apiKey').change(addApiKeyAuthorization);
+
+      // if you have an apiKey you would like to pre-populate on the page for demonstration
purposes...
+      /*
+        var apiKey = "myApiKeyXXXX123456789";
+        $('#input_apiKey').val(apiKey);
+      */
+
+      window.swaggerUi.load();
+
+      function log() {
+        if ('console' in window) {
+          console.log.apply(console, arguments);
+        }
+      }
+  });
+  </script>
+</head>
+
+<body class="swagger-section">
+<div id="message-bar" class="swagger-ui-wrap">&nbsp;</div>
+<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/cxf/blob/c887ba7a/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 2230961..4323fa1 100644
--- a/distribution/src/main/release/samples/pom.xml
+++ b/distribution/src/main/release/samples/pom.xml
@@ -53,6 +53,7 @@
         <module>jax_rs/websocket</module>
         <module>jax_rs/description_swagger</module>
         <module>jax_rs/description_swagger2</module>
+        <module>jax_rs/description_swagger2_web</module>
         <module>callback</module>
         <module>wsdl_first_pure_xml</module>
         <module>jaxws_dispatch_provider</module>


Mime
View raw message