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:19:23 UTC

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

Repository: cxf
Updated Branches:
  refs/heads/master 4f1afbf76 -> 73198c5da


[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/14849cb7
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/14849cb7
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/14849cb7

Branch: refs/heads/master
Commit: 14849cb7c8b2117c45196da92df21151f8a78742
Parents: 4f1afbf
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:18:11 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/14849cb7/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/14849cb7/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/14849cb7/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/14849cb7/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/14849cb7/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/14849cb7/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);
             }
         }


[2/2] cxf git commit: [CXF-6789] Adding a resource

Posted by se...@apache.org.
[CXF-6789] Adding a resource


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

Branch: refs/heads/master
Commit: 73198c5da1efa83d9739b55f2d63a184504c8287
Parents: 14849cb
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Wed Feb 24 17:19:10 2016 +0000
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Wed Feb 24 17:19:10 2016 +0000

----------------------------------------------------------------------
 .../java/sample/rs/service/HelloService2.java   | 42 ++++++++++++++++++++
 1 file changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/73198c5d/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/HelloService2.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/HelloService2.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/HelloService2.java
new file mode 100644
index 0000000..2421047
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/HelloService2.java
@@ -0,0 +1,42 @@
+/**
+ * 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 sample.rs.service;
+import javax.ws.rs.GET;
+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("/sayHello2")
+@Service
+@Api("/sayHello2")
+public class HelloService2 {
+ 
+    @GET
+    @Path("/{a}")
+    @Produces(MediaType.TEXT_PLAIN)
+    public String sayHello(@PathParam("a") String a) {
+        return "Hello2 " + a + ", Welcome to CXF RS Spring Boot World!!!";
+    }
+    
+}