AdachiAndShimamura opened a new issue, #145:
URL: https://github.com/apache/dubbo-rust/issues/145

   ### 实现triple协议中支持curl访问的能力
        **基本思路:**  将接收到content-type为application/json的请求携带的数据转化为对应的grpc 
Message,再交给实际的handle进行处理,再将返回的grpc Message序列化为json数据,返回给客户端,以支持curl直接访问
   
   
   
        **实现方案:**
   - 使用prost-serde库,以支持prost生成的代码能与serde序列化工具能协同工作
   - 
修改dubbo-build模块,在编译生成代码时为Message实现使用serde库进行序列化反序列化的能力,以支持将json数据转化为grpc消息,如下所示:
   #[derive(Serialize, Deserialize)]
   #[serde(crate = "::serde")]
   #[serde(rename_all = "snake_case")]
   #[allow(clippy::derive_partial_eq_without_eq)]
   #[derive(Clone, PartialEq, ::prost::Message)]
   ‘pub struct GreeterReply {
       #[prost(string, tag = "1")]
       pub message: ::prost::alloc::string::String,
   }`
   - 修改TripleServer部分代码,以支持根据不同的content-type采用不同的处理方式
   - 修改Decoding部分代码或者添加一个专用于解析json数据的Decoding,以支持对于application/json请求数据的接收和处理
   - 
修改dubbo-build的构建规则,使prost生成的代码中假如一个对content-type的判断,以此分配不同的codec分别处理proto和json格式数据
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to