cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [12/17] cxf git commit: CXF-6046: Enhance SwaggerFeature to support JAX-RS annotations. Added customized Swagger UI.
Date Thu, 09 Jul 2015 09:05:07 GMT
CXF-6046: Enhance SwaggerFeature to support JAX-RS annotations. Added customized Swagger UI.


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

Branch: refs/heads/3.0.x-fixes
Commit: 56132d79a2f861ea9d9a894654d280857a0e34de
Parents: 8e38a00
Author: reta <drreta@gmail.com>
Authored: Wed Nov 12 13:37:12 2014 -0500
Committer: Akitoshi Yoshida <ay@apache.org>
Committed: Thu Jul 9 10:31:52 2015 +0200

----------------------------------------------------------------------
 .../samples/jax_rs/description_swagger/pom.xml  | 117 ++++++++++++-------
 .../webjars/swagger-ui/2.0.24/index.html        |  60 ++++++++++
 2 files changed, 134 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/56132d79/distribution/src/main/release/samples/jax_rs/description_swagger/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger/pom.xml b/distribution/src/main/release/samples/jax_rs/description_swagger/pom.xml
index fa49ef0..0faab16 100644
--- a/distribution/src/main/release/samples/jax_rs/description_swagger/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/description_swagger/pom.xml
@@ -39,42 +39,73 @@
             <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>
-
+                <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>
+    
+    <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.0.24</version>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${project.build.directory}/classes</outputDirectory>
+                                    <excludes>**/index.html</excludes>
+                                </artifactItem>                                
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    
     <dependencies>
-	    <dependency>
+        <dependency>
             <groupId>com.wordnik</groupId>
-	        <artifactId>swagger-jaxrs_2.10</artifactId>
-	        <exclusions>
-	        	<exclusion>
-	        		 <groupId>javax.ws.rs</groupId>
+            <artifactId>swagger-jaxrs_2.10</artifactId>
+            <exclusions>
+                <exclusion>
+                     <groupId>javax.ws.rs</groupId>
                      <artifactId>jsr311-api</artifactId>
-	        	</exclusion>
-	        </exclusions>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
-		  	<groupId>org.webjars</groupId>
-		  	<artifactId>swagger-ui</artifactId>
-		  	<version>2.0.24</version>
+              <groupId>org.webjars</groupId>
+              <artifactId>swagger-ui</artifactId>
+              <version>2.0.24</version>
+              <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>javassist</groupId>
@@ -82,15 +113,15 @@
             <version>3.12.1.GA</version>
         </dependency>     
         <dependency>
-		  	<groupId>com.fasterxml.jackson.jaxrs</groupId>
-		  	<artifactId>jackson-jaxrs-json-provider</artifactId>
-		  	<version>2.2.2</version>
-		</dependency>   		
-   		<dependency>
-			<groupId>com.fasterxml.jackson.core</groupId>
-   			<artifactId>jackson-core</artifactId>
-   			<version>2.2.2</version>
-   		</dependency>    
+              <groupId>com.fasterxml.jackson.jaxrs</groupId>
+              <artifactId>jackson-jaxrs-json-provider</artifactId>
+              <version>2.2.2</version>
+        </dependency>           
+           <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+               <artifactId>jackson-core</artifactId>
+               <version>2.2.2</version>
+           </dependency>    
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-transports-http</artifactId>
@@ -125,8 +156,8 @@
             <artifactId>javax.ws.rs-api</artifactId>
         </dependency>
         <dependency>
-		    <groupId>org.eclipse.jetty</groupId>
-		    <artifactId>jetty-webapp</artifactId>
-		</dependency>		
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-webapp</artifactId>
+        </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/56132d79/distribution/src/main/release/samples/jax_rs/description_swagger/src/main/resources/META-INF/resources/webjars/swagger-ui/2.0.24/index.html
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger/src/main/resources/META-INF/resources/webjars/swagger-ui/2.0.24/index.html
b/distribution/src/main/release/samples/jax_rs/description_swagger/src/main/resources/META-INF/resources/webjars/swagger-ui/2.0.24/index.html
new file mode 100644
index 0000000..5d18b8b
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/description_swagger/src/main/resources/META-INF/resources/webjars/swagger-ui/2.0.24/index.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>Swagger UI</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/screen.css' media='print' rel='stylesheet' type='text/css'/>
+  <script type="text/javascript" src="lib/shred.bundle.js"></script>
+  <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-1.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='lib/swagger.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>
+
+  <!-- enabling this will enable oauth2 implicit scope support -->
+  <script src='lib/swagger-oauth.js' type='text/javascript'></script>
+
+  <script type="text/javascript">
+    $(function () {
+      window.swaggerUi = new SwaggerUi({
+      url: "http://localhost:9000/api-docs",
+      dom_id: "swagger-ui-container",
+      supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
+      onComplete: function(swaggerApi, swaggerUi){
+        log("Loaded SwaggerUI");
+        $('pre code').each(function(i, e) {
+          hljs.highlightBlock(e)
+        });
+      },
+      onFailure: function(data) {
+        log("Unable to Load SwaggerUI");
+      },
+      docExpansion: "none",
+      sorter : "alpha"
+    });
+
+    $('#input_apiKey').change(function() {
+      var key = $('#input_apiKey')[0].value;
+      log("key: " + key);
+      if(key && key.trim() != "") {
+        log("added key " + key);
+        window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));
+      }
+    })
+    window.swaggerUi.load();
+  });
+  </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>


Mime
View raw message