怎么通过zookeeper节点获取Dubbo rest协议的服务请求路径呢? 5C

dubbo的配置如下

<dubbo:registry address="zookeeper://XXXXXXXXXXX:2181"/>
    <dubbo:protocol name="dubbo" port="20882" />
    <dubbo:protocol name="rest" server="tomcat" port="8002" contextpath="testPath"/>

服务提供者代码:


@Service(version = "${mem.service.version}")
@Path("mem")
public class MemberServiceImpl extends BaseServiceImpl<MemberMapper, Member> implements IMemberService {

    @Override
    @Path("hi")
    @GET
    @Produces({MediaType.TEXT_PLAIN})
    public String sayHi() {
        System.out.println("hi member");
        return "hi member, you get it!";
    }

    @Override
    public Member testGetById(Long id) {
        Member member = new Member();
        member.setName("test");
        member.setId(id);
        return member;
    }
}


zk节点内容:


rest://192.168.1.10:8001/testPath/com.jeomo.mem.service.IMemberService?anyhost=true&application=jeomo-mem&dubbo=2.6.2&generic=false&interface=com.jeomo.mem.service.IMemberService&methods=testGetById,removeById,lambdaQuery,save,removeByMap,update,getObj,saveOrUpdateBatch,sayHi,remove,listByIds,getBaseMapper,removeByIds,updateBatchById,lambdaUpdate,saveOrUpdate,listMaps,saveBatch,query,count,listObjs,list,getMap,updateById,pageMaps,listByMap,getById,getOne,page&pid=329108&revision=1.0.0&server=tomcat&side=provider&timestamp=1553690812928&version=1.0.0

我想要通过zk获取最终的请求路径,即@Path() 注解里的值,比如:
http://192.168.1.10:8001/testPath/mem/hi
该怎么获得 /mem/hi 这个路径。

1个回答

u012720534
鲤鱼师兄 就是这个路径 mem/hi 我怎么获取到呢
一年多之前 回复
u012720534
鲤鱼师兄 我不是想要host和端口,是想要后面的请求路径,也就是 @Path注解里的东西
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐