You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2016/02/24 18:20:04 UTC

[2/2] cxf git commit: [CXF-6789] Fixing the last AbstractSwaggerFeature commit and updating a spring boot demo

[CXF-6789] Fixing the last AbstractSwaggerFeature commit and updating a spring boot demo


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

Branch: refs/heads/3.1.x-fixes
Commit: 3134609dcd0443d4007a7829df57c148fff947b3
Parents: e4bfc16
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Wed Feb 24 17:18:11 2016 +0000
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Wed Feb 24 17:19:52 2016 +0000

----------------------------------------------------------------------
 .../release/samples/jax_rs/jaxrs_spring_boot/README     | 12 ++++++++++--
 .../src/main/java/sample/rs/service/HelloService.java   |  4 ++++
 .../java/sample/rs/service/SampleRestApplication.java   |  4 +++-
 .../sample/rs/service/SampleScanRestApplication.java    |  2 +-
 .../sample/rs/service/SampleScanRestApplication2.java   |  5 +++--
 .../cxf/jaxrs/swagger/AbstractSwaggerFeature.java       |  2 +-
 6 files changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/3134609d/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/README
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/README b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/README
index 5b8fb60..e46b561 100644
--- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/README
+++ b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/README
@@ -9,8 +9,16 @@ The sample uses Maven. It can be built and run from the command line:
 $ mvn spring-boot:run
 ----
 
-http://localhost:8080/services/helloservice/sayHello/ApacheCxfUser will now display the output in the browser
-like "Hello ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!"
+http://localhost:8080/services/helloservice/sayHello/ApacheCxfUser
+
+will display "Hello ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!"
+
+http://localhost:8080/services/helloservice/sayHello2/ApacheCxfUser
+
+will display "Hello2 ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!"
+
+http://localhost:8080/services/helloservice/swagger.json will return a Swagger JSON
+description of services.
 
 To run the client from a command line open a new terminal window and run:
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/3134609d/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/HelloService.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/HelloService.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/HelloService.java
index beef6f5..069672d 100644
--- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/HelloService.java
+++ b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/HelloService.java
@@ -22,10 +22,14 @@ import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
+
 import org.springframework.stereotype.Service;
+
+import io.swagger.annotations.Api;
  
 @Path("/sayHello")
 @Service
+@Api("/sayHello")
 public class HelloService {
  
     @GET

http://git-wip-us.apache.org/repos/asf/cxf/blob/3134609d/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java
index 81df51b..8ee0d14 100644
--- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java
+++ b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java
@@ -17,6 +17,8 @@
  * under the License.
  */
 package sample.rs.service;
+import java.util.Arrays;
+
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.spring.JaxRsConfig;
@@ -44,7 +46,7 @@ public class SampleRestApplication {
     @Bean
     public Server rsServer() {
         JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
-        endpoint.setServiceBean(new HelloService());
+        endpoint.setServiceBeans(Arrays.asList(new HelloService(), new HelloService2()));
         endpoint.setAddress("/helloservice");
         return endpoint.create();
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/3134609d/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication.java
index 5be53a8..7567e0a 100644
--- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication.java
+++ b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication.java
@@ -43,7 +43,7 @@ public class SampleScanRestApplication {
         // Or create a simple Swagger2Feature @Component-annotated extension
         // and drop this method if a default feature setup is OK
         Swagger2Feature feature = new Swagger2Feature();
-        feature.setRunAsFilter(true);
+        //feature.setRunAsFilter(true);
         return feature;
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/3134609d/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication2.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication2.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication2.java
index 97f3ed7..43c8d37 100644
--- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication2.java
+++ b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication2.java
@@ -17,7 +17,8 @@
  * under the License.
  */
 package sample.rs.service;
-import java.util.Collections;
+import java.util.Arrays;
+import java.util.HashSet;
 import java.util.Set;
 
 import javax.servlet.ServletConfig;
@@ -63,7 +64,7 @@ public class SampleScanRestApplication2 {
     @ApplicationPath("/services/helloservice")
     public static class JaxrsApplication extends Application { 
         public Set<Object> getSingletons() {
-            return Collections.<Object>singleton(new HelloService());
+            return new HashSet<Object>(Arrays.asList(new HelloService(), new HelloService2()));
         }
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/3134609d/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java
index 7408c6d..139f838 100644
--- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java
+++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java
@@ -92,7 +92,7 @@ public abstract class AbstractSwaggerFeature extends AbstractFeature {
                 serviceClasses.add(cri.getServiceClass());
             }
             String sharedPackage = PackageUtils.getSharedPackageName(serviceClasses);
-            if (!StringUtils.isEmpty(getResourcePackage())) {
+            if (!StringUtils.isEmpty(sharedPackage)) {
                 setResourcePackage(sharedPackage);
             }
         }