Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update rest and spring cloud samples #879

Merged
merged 2 commits into from
Jul 14, 2023

Conversation

chickenlj
Copy link
Contributor

@chickenlj chickenlj commented Jul 13, 2023

问题1

直接跑 dubbo-call-sc 示例,解决以下问题:

image

然后,依次去掉以下注解配置要求:

  • Controller 注解
  • Produces 配置

apache/dubbo#12719

@FeignClient(name = "spring-cloud-provider-for-dubbo")
如果这个能映射到 Dubbo 中的 providedBy 就太棒了!

问题2

image

这几种类型客户端怎么通过配置指定

问题3

Spring Web 注解支持的范围,哪些支持哪些不支持,如 PathVariable 等,怎么能明确的列出来。

问题4

从provider视角来看,如果未来我默认给 dubbo 协议注入 http 支持,那么我直接自动注入 extra-protocol=rest,启动rest加载流程是否合适?未来有没有更好的方法,理论上就是dubbo协议实现上再增加http server支持,那么这样的支持和triple中的h1 unary的区别是?

rest的无注解能不能和triple unary合并?

问题5

当前的 jetty/servlet/tomcat/resteasy/netty 这些之间的关系?

问题6

跑 sc-call-dubbo 的示例,修复以下问题

http://localhost:8099/dubbo/rest/test2

image

@chickenlj chickenlj merged commit 4693e1f into apache:master Jul 14, 2023
@chickenlj chickenlj deleted the rest-springcloud branch July 14, 2023 02:56
@suncairong163
Copy link

suncairong163 commented Jul 16, 2023

问题2

因为dubbo http consumer一端实现http 调用的RestClient 实现有三种形式:httpclient,okhttp,URLConnection(jdk内置)
默认请情况下采用okhttp,因此在使用dubbo http 去调用其他http服务时,需要添加引入的依赖有

         <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-rpc-rest</artifactId>
            <version>${dubbo-rpc-rest_version}</version>
         </dependency>
         或
         <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>mockwebserver</artifactId>
            <version>${okhttp_version}</version>
         </dependency>
         或
         <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient_version}</version>
         </dependency>

URL 参数client 可配置参数有ok-http ,url-connection ,apache-http-client 默认为ok-http

  @DubboReference(id = "demoService", group = "demo", version = "1.2.3", consumer="my-consumer", client = "apache-http-client")
        private DemoService demoService;

@suncairong163
Copy link

问题3

数据位置 content-type spring注解 resteasy注解
body 无要求 ReuqestBody  无注解即为body
querystring(?test=demo) 无要求 RequestParam QueryParam
header 无要求 RequestHeader PathParam
form application/x-www-form-urlencoded RequestParam ReuqestBody FormParam
path 无要求 PathVariable PathParam
method 无要求 PostMapping GetMapping GET POST
url PostMapping GetMapping path属性 Path
content-type PostMapping GetMapping consumers属性 Consumers
Accept PostMapping GetMapping produces属性 Produces

@suncairong163
Copy link

问题1,6报错已经修复提交pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants