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:03 UTC

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

Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes e4bfc1647 -> 12225d4f5


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

Branch: refs/heads/3.1.x-fixes
Commit: 12225d4f560c30839fd8f2ecb6657663d7559a27
Parents: 3134609
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:52 2016 +0000

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


http://git-wip-us.apache.org/repos/asf/cxf/blob/12225d4f/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!!!";
+    }
+    
+}


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

Posted by se...@apache.org.
[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);
             }
         }