In netty-http code, we select the destination route with the maximum number of group match.
e.g. Consider the endpoints:
If the request is for url "/apps/someapp/schedules/DailySchedule/status", it should ideally routed to the second endpoint, however since we select the endpoint with the maximum number of group matches it is routed to the 1st endpoint which has 3 groups as opposed to 2nd endpoint which only has 2 groups.
We decided to go with weighted scores for matching request URI parts to destination path parts. The matches are weighted in descending order from left to right. For every match, exact matches have higher weight than group matches, and group matches have higher weight than wildcard matches.