cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [09/48] cxf git commit: Updating jaxrs spring boot demos to use the application context
Date Wed, 29 Jun 2016 22:44:07 GMT
Updating jaxrs spring boot demos to use the application context


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

Branch: refs/heads/master-jaxrs-2.1
Commit: 73e9c7424cf5bd41029f60df6fe6de850608ad26
Parents: e2bc8eb
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Thu Jun 9 12:50:37 2016 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Thu Jun 9 12:50:37 2016 +0100

----------------------------------------------------------------------
 .../rs/client/SampleRestClientApplication.java  | 24 +++++++++-----
 .../main/resources/sample/rs/client/client.xml  | 33 ++++++++++++++++++++
 .../rs/client/SampleRestClientApplication.java  | 22 ++++++++-----
 .../main/resources/sample/rs/client/client.xml  | 33 ++++++++++++++++++++
 4 files changed, 97 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/73e9c742/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java
b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java
index 448861c..b0ab7f0 100644
--- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java
+++ b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java
@@ -18,19 +18,27 @@
  */
 package sample.rs.client;
 
-import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 import sample.rs.service.HelloService;
 
 
 public final class SampleRestClientApplication {
-    private SampleRestClientApplication() {
-        
-    }
+    private HelloService helloService;
+    
     public static void main(String[] args) {
-        HelloService service = 
-            JAXRSClientFactory.create("http://localhost:8080/services/helloservice/", 
-                                      HelloService.class);
-        System.out.println(service.sayHello("ApacheCxfUser"));
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("sample/rs/client/client.xml");
+        SampleRestClientApplication clientApp = ctx.getBean(SampleRestClientApplication.class);
+        System.out.println(clientApp.getHelloService().sayHello("ApacheCxfUser"));
+        ctx.close();
+    }
+
+    public HelloService getHelloService() {
+        return helloService;
+    }
+
+    public void setHelloService(HelloService helloService) {
+        this.helloService = helloService;
     }  
 }
+

http://git-wip-us.apache.org/repos/asf/cxf/blob/73e9c742/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/resources/sample/rs/client/client.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/resources/sample/rs/client/client.xml
b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/resources/sample/rs/client/client.xml
new file mode 100644
index 0000000..7ba6911
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/resources/sample/rs/client/client.xml
@@ -0,0 +1,33 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" 
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+       xmlns:jaxrs="http://cxf.apache.org/jaxrs-client"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                           http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://cxf.apache.org/jaxrs-client http://cxf.apache.org/schemas/jaxrs-client.xsd">
+    <jaxrs:client id="helloServiceClient" 
+        address="http://localhost:8080/services/helloservice/" 
+        serviceClass="sample.rs.service.HelloService"/>
+        
+    <bean class="sample.rs.client.SampleRestClientApplication">
+        <property name="helloService" ref="helloServiceClient"/>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/cxf/blob/73e9c742/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/client/SampleRestClientApplication.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/client/SampleRestClientApplication.java
b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/client/SampleRestClientApplication.java
index 430a610..183c4a8 100644
--- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/client/SampleRestClientApplication.java
+++ b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/client/SampleRestClientApplication.java
@@ -18,18 +18,26 @@
  */
 package sample.rs.client;
 
-import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 import sample.rs.service.HelloService;
 
 
 public final class SampleRestClientApplication {
-    private SampleRestClientApplication() {
-        
-    }
+    private HelloService helloService;
+    
     public static void main(String[] args) {
-        HelloService service = JAXRSClientFactory.create("http://localhost:8080/services/helloservice/",

-                                    HelloService.class);
-        System.out.println(service.sayHello("ApacheCxfUser"));
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("sample/rs/client/client.xml");
+        SampleRestClientApplication clientApp = ctx.getBean(SampleRestClientApplication.class);
+        System.out.println(clientApp.getHelloService().sayHello("ApacheCxfUser"));
+        ctx.close();
+    }
+
+    public HelloService getHelloService() {
+        return helloService;
+    }
+
+    public void setHelloService(HelloService helloService) {
+        this.helloService = helloService;
     }  
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/73e9c742/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/sample/rs/client/client.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/sample/rs/client/client.xml
b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/sample/rs/client/client.xml
new file mode 100644
index 0000000..7ba6911
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/sample/rs/client/client.xml
@@ -0,0 +1,33 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" 
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+       xmlns:jaxrs="http://cxf.apache.org/jaxrs-client"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                           http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://cxf.apache.org/jaxrs-client http://cxf.apache.org/schemas/jaxrs-client.xsd">
+    <jaxrs:client id="helloServiceClient" 
+        address="http://localhost:8080/services/helloservice/" 
+        serviceClass="sample.rs.service.HelloService"/>
+        
+    <bean class="sample.rs.client.SampleRestClientApplication">
+        <property name="helloService" ref="helloServiceClient"/>
+    </bean>
+</beans>


Mime
View raw message