advantageous / qbit

The Java microservice lib. QBit is a reactive programming lib for building microservices - JSON, HTTP, WebSocket, and REST. QBit uses reactive programming to build elastic REST, and WebSockets based cloud friendly, web services. SOA evolved for mobile and cloud. ServiceDiscovery, Health, reactive StatService, events, Java idiomatic reactive programming for Microservices.
http://advantageous.github.io/qbit/
Apache License 2.0
709 stars 140 forks source link

request can not be routedd correctly #780

Closed dreamshit closed 2 years ago

dreamshit commented 6 years ago

hello, I am from china, I am glad to meet the qbit. it is really fast so that I use it in my project. But I encounter some problems. the business need a short link, like:
path: http://aaa/{bb}/{cc}
method: get so I start server with rootUri("/") class RequestMapping("/") or RequestMapping("/{bb}") method RequestMapping(value = "/{cc}", method = RequestMethod.GET) it works

but now I need other GET-method-link. these GET-path will be routed into the first class sometimes.

I read the source of qbit, CallType.ADDRESS_WITH_PATH_PARAMS was put int to treeMap, and use treeMap.lowerEntry when handle the request . so I change other GET-method-link , put the method into the first class it works,

but I read more the source of qbit, I found some code class:StandardMetaDataProvider line: 129

final String requestPath =
                    StringScanner.substringBefore(requestMeta.getRequestURI(), "{");
int count = Str.split(servicePath + requestURI, '/').length - 1;
map.put(count, metaData);

it means if I add GET-link int the first class like RequestMapping("/ddd/{eee}"), because my first short link, if {bbb} lower than ddd ,it will be routed to my first method, others will be right routed into my new method.

so I change ddd to {ddd}: /{ddd}/{eee}, now treeMap has one key "/", it will be routed to the method by path-length. it works.

now my first class has 3 method, their path-length are different, if I need more GET-link with path params I need to add path length so that it can be routed. it is unreasonable.

do you have some good suggestions for me ? I am sorry for my Poor English, I had try my best to describe my problems. need your help thanks

dreamshit commented 2 years ago

no longer use