liubao68 commented on a change in pull request #13: 补充客户端示例 AsyncRestTemplate 
,对其他示例进行完善
URL: 
https://github.com/apache/incubator-servicecomb-docs/pull/13#discussion_r200529211
 
 

 ##########
 File path: java-chassis-reference/zh_CN/build-consumer/using-resttemplate.md
 ##########
 @@ -32,12 +34,39 @@ public class SpringmvcConsumerMain {
         BeanUtils.init();
     }
 }
+
+
+
+
+```
+
+* JAX RS 客户端示例代码:
+
+```java
+
+@Component
+public class JaxrsConsumerMain {
+
+    public static void main(String[] args) throws Exception {
+        init();
+        //其他都类似spring MVC示例的客户端代码,注意如果服务端只接收 GET 请求,要使用方法 getForObject()
+        RestTemplate restTemplate = RestTemplateBuilder.create();
+        String result = 
restTemplate.getForObject("cse://jaxrs/jaxrshello/saybye", String.class);
+    }
+
+    public static void init() throws Exception {
+        Log4jUtils.init();
+        BeanUtils.init();
+    }
+}
 ```
 
 > 说明:
 >
 > * 
 > URL格式为:`cse://microserviceName/path?querystring`。以[用SpringMVC开发微服务](/用SpringMVC开发微服务)中定义的服务提供者为例,其微服务名称是springmvc,basePath是`/springmvchello`,那么URL中的microserviceName=`springmvc`,请求sayhi时的path=`springmvchello/sayhi`,所以示例代码中请求sayhi的URL是`cse://springmvc/springmvchello/sayhi?name=Java
 >  Chassis`。
 > * 使用这种URL格式,ServiceComb框架会在内部进行服务发现、熔断容错等处理并最终将请求发送到服务提供者。
 
+![](java-chassis-reference/zh_CN/build-consumer/consumer-serviceName.PNG)
 
 Review comment:
   这些示例,尽可能不要使用图片。 简单的组织下语言,贴上源码。 尽可能少的贴图, 万不得已不要使用图片。 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to