Package com.hsbc.cranker.mucranker
Class LongestFirstRouteResolver
- java.lang.Object
-
- com.hsbc.cranker.mucranker.LongestFirstRouteResolver
-
- All Implemented Interfaces:
RouteResolver
public class LongestFirstRouteResolver extends Object implements RouteResolver
A route resolver which using the longest route to match from the existing routes.
-
-
Constructor Summary
Constructors Constructor Description LongestFirstRouteResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringresolve(Set<String> routes, String target)Algorithm: using the longest route to match from the existing routes.
-
-
-
Method Detail
-
resolve
public String resolve(Set<String> routes, String target)
Algorithm: using the longest route to match from the existing routes.e.g. if request route is "/my-service/api/test" , it will try below mapping one by one, If no matching found, use "*"
- "my-service/api/test"
- "my-service/api"
- "my-service"
- Specified by:
resolvein interfaceRouteResolver- Parameters:
routes- all the existing routes in crankertarget- requests uri path, e.g. /my-service/api- Returns:
- route
-
-