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

rest service Path no found, #12330

Closed
1 task
songlongkuan opened this issue May 16, 2023 · 3 comments
Closed
1 task

rest service Path no found, #12330

songlongkuan opened this issue May 16, 2023 · 3 comments
Labels
type/bug Bugs to being fixed

Comments

@songlongkuan
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 3.2.0
  • Operating System version: Mac os 13
  • Java version: openjdk 1.8

Steps to reproduce this issue

  1. 提供者定义接口
    @path("person")
    public interface PersonService {

    @get // admin项目订阅zk时当interface包含内部类$字符时出现问题 #3
    @path("{id: \d+}")
    String getUser(@PathParam("id") Long id);

    @get
    @path("getPerson")
    String getPerson(@QueryParam("source") String source);
    }

2.提供者实现类
@DubboService(interfaceClass = PersonService.class, protocol = {"rest", "dubbo"},version = "1.0.0",group = "dubbo-provider")
public class DubboPersonServiceImpl implements PersonService {

@Override
public String getUser(Long id) {
    return String.valueOf(id);
}

@Override
public String getPerson(String source) {
    return source;
}

}
3. 配置文件
dubbo:
registry:
protocol: zookeeper
address: 127.0.0.1:2181
protocol:
rest:
name: rest
port: 9001
dubbo:
name: dubbo
port: 8001
consumer:
version: 1.0.0
timeout: 10000
retries: 0
check: false
provider:
version: 1.0.0
group: dubbo-provider
validation: false
application:
name: dubbo-provider

4.. 发起curl请求

curl --location --request GET 'localhost:9001/person/getPerson'
--header 'rest-service-version: 1.0.0'
--header 'rest-service-group: dubbo-provider'
--header 'version: 1.0.0'
--header 'group: dubbo-provider'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'source=postman'
--data-urlencode 'version=1.0.0'

响应结果是错误的:
rest service Path no found, current path info:PathMatcher{path='/person/getPerson', version='null', group='null', port=null, hasPathVariable=false, contextPath='null'}

他应该调用到getPerson接口的,但是一直调用不到

Expected Behavior

Actual Behavior

If there is an exception, please attach the exception trace:

rest service Path no found, current path info:PathMatcher{path='/person/getPerson', version='null', group='null', port=null, hasPathVariable=false, contextPath='null'}
@songlongkuan songlongkuan added the type/bug Bugs to being fixed label May 16, 2023
@AlbumenJ
Copy link
Member

@suncairong163 PTAL

@suncairong163
Copy link
Contributor

org.apache.dubbo.rpc.protocol.rest.constans.RestConstant#REST_HEADER_PREFIX 可以看一下这个字段的值吗, 最近把之前的
#rest#前缀改成了 rest-service-
这个pr #12275

@songlongkuan
Copy link
Author

这段代码已经删掉了,最后我把postman请求头groupId,version 都删掉反而好了,dubbo提供者也把groupId、version删掉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bugs to being fixed
Projects
None yet
Development

No branches or pull requests

3 participants