You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/03/26 13:05:00 UTC

[incubator-servicecomb-java-chassis] branch master updated (40afa61 -> c9b0704)

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git.


    from 40afa61  SCB-431 Updated the license header of bmi application.yaml
     new 856e4c7  SCB-434 fix jaxrs-provider sample dependency
     new c9b0704  SCB-434 add @GET sample code and update readme

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 samples/jaxrs-sample/README.md                                    | 3 ++-
 samples/jaxrs-sample/jaxrs-consumer/pom.xml                       | 4 ++++
 .../servicecomb/samples/jaxrs/consumer/JaxrsConsumerMain.java     | 6 ++++++
 samples/jaxrs-sample/jaxrs-provider/pom.xml                       | 2 +-
 .../apache/servicecomb/samples/jaxrs/provider/JaxrsHelloImpl.java | 8 ++++++++
 5 files changed, 21 insertions(+), 2 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.

[incubator-servicecomb-java-chassis] 02/02: SCB-434 add @GET sample code and update readme

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git

commit c9b070424c5581a09d4af6511ae9390116ff95b3
Author: zhengyangyong <ya...@huawei.com>
AuthorDate: Mon Mar 26 19:02:34 2018 +0800

    SCB-434 add @GET sample code and update readme
    
    Signed-off-by: zhengyangyong <ya...@huawei.com>
---
 samples/jaxrs-sample/README.md                                    | 3 ++-
 samples/jaxrs-sample/jaxrs-consumer/pom.xml                       | 4 ++++
 .../servicecomb/samples/jaxrs/consumer/JaxrsConsumerMain.java     | 6 ++++++
 .../apache/servicecomb/samples/jaxrs/provider/JaxrsHelloImpl.java | 8 ++++++++
 4 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/samples/jaxrs-sample/README.md b/samples/jaxrs-sample/README.md
index f804277..25dad6c 100644
--- a/samples/jaxrs-sample/README.md
+++ b/samples/jaxrs-sample/README.md
@@ -64,4 +64,5 @@ To consume a provider-service, only need to decalare a member of a service API t
    
    On the consumer side, you can see the following outputs if the consumer can invoke the producer:
    1. *'Hello Java Chassis'* means the consumer calls sayhi by RpcReference successfully
-   2. *'Hello person ServiceComb/Java Chassis'* means the consumer calls sayhello by RpcReference successfully
\ No newline at end of file
+   2. *'Hello person ServiceComb/Java Chassis'* means the consumer calls sayhello by RpcReference successfully
+   3. *'Bye !'* means the consumer calls saybye by RestTemplate successfully
\ No newline at end of file
diff --git a/samples/jaxrs-sample/jaxrs-consumer/pom.xml b/samples/jaxrs-sample/jaxrs-consumer/pom.xml
index aa33ab4..9aae2be 100644
--- a/samples/jaxrs-sample/jaxrs-consumer/pom.xml
+++ b/samples/jaxrs-sample/jaxrs-consumer/pom.xml
@@ -51,6 +51,10 @@
             <artifactId>provider-pojo</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.servicecomb</groupId>
+            <artifactId>provider-springmvc</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
         </dependency>
diff --git a/samples/jaxrs-sample/jaxrs-consumer/src/main/java/org/apache/servicecomb/samples/jaxrs/consumer/JaxrsConsumerMain.java b/samples/jaxrs-sample/jaxrs-consumer/src/main/java/org/apache/servicecomb/samples/jaxrs/consumer/JaxrsConsumerMain.java
index 7fa2ed4..67bcab5 100644
--- a/samples/jaxrs-sample/jaxrs-consumer/src/main/java/org/apache/servicecomb/samples/jaxrs/consumer/JaxrsConsumerMain.java
+++ b/samples/jaxrs-sample/jaxrs-consumer/src/main/java/org/apache/servicecomb/samples/jaxrs/consumer/JaxrsConsumerMain.java
@@ -19,9 +19,11 @@ package org.apache.servicecomb.samples.jaxrs.consumer;
 import org.apache.servicecomb.foundation.common.utils.BeanUtils;
 import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
 import org.apache.servicecomb.provider.pojo.RpcReference;
+import org.apache.servicecomb.provider.springmvc.reference.RestTemplateBuilder;
 import org.apache.servicecomb.samples.common.schema.Hello;
 import org.apache.servicecomb.samples.common.schema.models.Person;
 import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
 
 @Component
 public class JaxrsConsumerMain {
@@ -35,6 +37,10 @@ public class JaxrsConsumerMain {
     Person person = new Person();
     person.setName("ServiceComb/Java Chassis");
     System.out.println(hello.sayHello(person));
+
+    RestTemplate restTemplate = RestTemplateBuilder.create();
+    String result = restTemplate.getForObject("cse://jaxrs/jaxrshello/saybye", String.class);
+    System.out.println(result);
   }
 
   public static void init() throws Exception {
diff --git a/samples/jaxrs-sample/jaxrs-provider/src/main/java/org/apache/servicecomb/samples/jaxrs/provider/JaxrsHelloImpl.java b/samples/jaxrs-sample/jaxrs-provider/src/main/java/org/apache/servicecomb/samples/jaxrs/provider/JaxrsHelloImpl.java
index 3bb0e5a..f2cf332 100644
--- a/samples/jaxrs-sample/jaxrs-provider/src/main/java/org/apache/servicecomb/samples/jaxrs/provider/JaxrsHelloImpl.java
+++ b/samples/jaxrs-sample/jaxrs-provider/src/main/java/org/apache/servicecomb/samples/jaxrs/provider/JaxrsHelloImpl.java
@@ -18,6 +18,7 @@
 package org.apache.servicecomb.samples.jaxrs.provider;
 
 
+import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
@@ -45,4 +46,11 @@ public class JaxrsHelloImpl implements Hello {
   public String sayHello(Person person) {
     return "Hello person " + person.getName();
   }
+
+  @Path("/saybye")
+  @GET
+  public String sayBye() {
+    return "Bye !";
+  }
+
 }

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.

[incubator-servicecomb-java-chassis] 01/02: SCB-434 fix jaxrs-provider sample dependency

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git

commit 856e4c705afd91017c1cd04d50a06d563b6018fa
Author: zhengyangyong <ya...@huawei.com>
AuthorDate: Mon Mar 26 15:55:26 2018 +0800

    SCB-434 fix jaxrs-provider sample dependency
    
    Signed-off-by: zhengyangyong <ya...@huawei.com>
---
 samples/jaxrs-sample/jaxrs-provider/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/jaxrs-sample/jaxrs-provider/pom.xml b/samples/jaxrs-sample/jaxrs-provider/pom.xml
index c048012..b850655 100644
--- a/samples/jaxrs-sample/jaxrs-provider/pom.xml
+++ b/samples/jaxrs-sample/jaxrs-provider/pom.xml
@@ -48,7 +48,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.servicecomb</groupId>
-            <artifactId>provider-rest-common</artifactId>
+            <artifactId>provider-jaxrs</artifactId>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.