You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/08/22 06:55:04 UTC

[GitHub] imlidian commented on a change in pull request #40: Using java chassis in spring boot dir translation

imlidian commented on a change in pull request #40: Using java chassis in spring boot dir translation
URL: https://github.com/apache/incubator-servicecomb-docs/pull/40#discussion_r211845862
 
 

 ##########
 File path: java-chassis-reference/en_US/using-java-chassis-in-spring-boot/diff-spring-mvc.md
 ##########
 @@ -1,73 +1,73 @@
-java chassis支持使用Spring MVC提供的标签\(org.springframework.web.bind.annotation\)来声明REST接口,但是两者是独立的实现,而且有不一样的设计目标。java chassis的目标是提供跨语言、支持多通信协议的框架,因此去掉了Spring MVC中一些对跨语言支持不是很好的特性,也不支持特定运行框架强相关的特性,比如直接访问Servlet协议定义的HttpServletRequest。下面是一些显著的差别。
 
-* 服务声明方式
+Java chassis supports the use of the label \(org.springframework.web.bind.annotation\) provided by Spring MVC to declare the REST interface, but the two are independent implementations and have different design goals. The goal of the java chassis is to provide a cross-language framework that supports multiple communication protocols. Therefore, some features of Spring MVC that are not very good for cross-language support are removed, and features that are strongly related to a specific running framework are not supported, such as direct access to the Servlet protocol definition. HttpServletRequest. Here are some notable differences.
 
-Spring MVC使用@RestController声明服务,而java chassis使用@RestSchema声明服务,并且需要显示的使用@RequestMapping声明服务路径,以区分该服务是采用Spring MVC的标签还是使用JAX RS的标签。
+* Service declaration method
+
+Spring MVC uses @RestController to declare the service, and java chassis uses @RestSchema to declare the service and needs to display the service path using @RequestMapping to distinguish whether the service uses Spring MVC tags or JAX RS tags.
 
 ```
 @RestSchema(schemaId = "hello")
 @RequestMapping(path = "/")
 ```
 
-Schema是java chassis的服务契约,是服务运行时的基础,服务治理、编解码等都基于契约进行。在跨语言的场景,契约也定义了不同语言能够同时理解的部分。
+The schema is the service contract of java chassis, which is the basis of service runtime. Service management, codec and so on are all based on contract. In a cross-language scenario, the contract also defines the parts of the language that can be understood simultaneously.
 
-* 数据类型支持
+* Data type support
 
-采用Spring MVC,可以在服务定义中使用多种数据类型,只要这种数据类型能够被json序列化和反序列化。比如:
+With Spring MVC, you can use multiple data types in a service definition as long as it can be serialized and deserialized by json. Such as:
 
 ```
-// 抽象类型
-public void postData(@RequestBody Object data)
-// 接口定义
-public void postData(@RequestBody IPerson interfaceData)
-// 没指定类型的泛型
-public void postData(@RequestBody Map rawData)
-// 具体协议相关的类型
-public void postData(HttpServletRequest rquest)
+// abstract type
+Public void postData(@RequestBody Object data)
+// Interface definition
+Public void postData(@RequestBody IPerson interfaceData)
+// no generic type of the specified type
+Public void postData(@RequestBody Map rawData)
+// specific protocol related types
+Public void postData(HttpServletRequest request)
 ```
 
-上面的类型在java chassis都不提供支持。因为java chassis会根据接口定义生成契约,从上面的接口定义,如果不结合实际的实现代码或者额外的开发文档说明,无法直接生成契约。也就是站在浏览器的REST视角,不知道如何在body里面构造消息内容。
+The above types are not supported in the java chassis. Because java chassis will generate contracts according to the interface definition, from the above interface definition, if you do not combine the actual implementation code or additional development documentation, you can not directly generate the contract. That is, standing in the REST perspective of the browser, I don't know how to construct the message content in the body.
 
-为了支持快速开发,java chassis的数据类型限制也在不停的扩充,比如支持HttpServletRequest,但是实际在使用的时候,他们与WEB服务器的语义是不一样的,比如不能直接操作流。因此建议开发者在的使用场景下,尽可能使用契约能够描述的类型,让代码阅读性更好。
+To support rapid development, the data type restrictions of java chassis are also constantly expanding, such as support for HttpServletRequest, but when they are used, they are different from the semantics of the WEB server, such as the inability to directly manipulate the stream. Therefore, it is recommended that the developer use the type of contract that can be described as much as possible in the usage scenario so that the code is more readable.
 
-java chassis在数据类型的支持方面的更多说明,请参考"支持的数据类型"章节。
+For more information on java chassis support for data types, please refer to the "Supported Data Types" section.
 
-* 常用标签支持
+* Common label support
 
 Review comment:
   那中文应该是注解才对,这个需要改下。标签当然是label

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services