Package org.apache.camel.support
Class RestConsumerContextPathMatcher
java.lang.Object
org.apache.camel.support.RestConsumerContextPathMatcher
A context path matcher when using rest-dsl that allows components to reuse the same matching logic.
The component should use the
matchBestPath(String, String, List)
with the request details and the matcher
returns the best matched, or null if none could be determined.
The RestConsumerContextPathMatcher.ConsumerPath
is used for the components to provide the details to the matcher.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Consumer path details which must be implemented and provided by the components. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> RestConsumerContextPathMatcher.ConsumerPath
<T> matchBestPath
(String requestMethod, String requestPath, List<RestConsumerContextPathMatcher.ConsumerPath<T>> consumerPaths) Finds the best matching of the list of consumer paths that should service the incoming request.static boolean
Does the incoming request match the given consumer path (ignore case)static void
Pre-compiled consumer path for wildcard matchstatic void
unRegister
(String consumerPath) if the rest consumer is removed, we also remove pattern cache.
-
Method Details
-
matchPath
Does the incoming request match the given consumer path (ignore case)- Parameters:
requestPath
- the incoming request context pathconsumerPath
- a consumer pathmatchOnUriPrefix
- whether to use the matchOnPrefix option- Returns:
- true if matched, false otherwise
-
matchBestPath
public static <T> RestConsumerContextPathMatcher.ConsumerPath<T> matchBestPath(String requestMethod, String requestPath, List<RestConsumerContextPathMatcher.ConsumerPath<T>> consumerPaths) Finds the best matching of the list of consumer paths that should service the incoming request.- Parameters:
requestMethod
- the incoming request HTTP methodrequestPath
- the incoming request context pathconsumerPaths
- the list of consumer context path details- Returns:
- the best matched consumer, or null if none could be determined.
-
register
Pre-compiled consumer path for wildcard match- Parameters:
consumerPath
- a consumer path
-
unRegister
if the rest consumer is removed, we also remove pattern cache.- Parameters:
consumerPath
- a consumer path
-