Package org.forgerock.http.routing
Class RouteMatchers
- java.lang.Object
-
- org.forgerock.http.routing.RouteMatchers
-
public final class RouteMatchers extends Object
A utility class that contains methods for creating route matchers.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ResourceApiVersionBehaviourManager
newResourceApiVersionBehaviourManager()
Creates a newResourceApiVersionBehaviourManager
which is responsibly for managing whether warning headers are returned and the default version behaviour when the Accept-API-Version header is not present on the request.static RouteMatcher<Request>
requestResourceApiVersionMatcher(Version version)
Creates aRouteMatcher
instance that matches the request resource API version with the provided version.static RouteMatcher<Request>
requestUriMatcher(RoutingMode mode, String template)
Creates aRouteMatcher
instance that matchesRequest
s with the provided mode and template.static Filter
resourceApiVersionContextFilter(ResourceApiVersionBehaviourManager behaviourManager)
Creates aFilter
which MUST be placed, in the route, before any API Version routing takes place.static RouteMatcher<Version>
resourceApiVersionMatcher(Version version)
Creates aRouteMatcher
instance that matches the request resource API version with the provided version.static RouteMatcher<Request>
selfApiMatcher()
A matcher to check if the request is for all versions of the API descriptor of the current path.static RouteMatcher<List<String>>
uriMatcher(RoutingMode mode, String template)
Creates aRouteMatcher
instance that matchesResourcePath
s with the provided mode and template.
-
-
-
Method Detail
-
uriMatcher
public static RouteMatcher<List<String>> uriMatcher(RoutingMode mode, String template)
Creates aRouteMatcher
instance that matchesResourcePath
s with the provided mode and template.- Parameters:
mode
- The routing mode.template
- The uri template.- Returns:
- A
RouteMatcher
instance.
-
requestUriMatcher
public static RouteMatcher<Request> requestUriMatcher(RoutingMode mode, String template)
Creates aRouteMatcher
instance that matchesRequest
s with the provided mode and template.- Parameters:
mode
- The routing mode.template
- The uri template.- Returns:
- A
RouteMatcher
instance.
-
newResourceApiVersionBehaviourManager
public static ResourceApiVersionBehaviourManager newResourceApiVersionBehaviourManager()
Creates a newResourceApiVersionBehaviourManager
which is responsibly for managing whether warning headers are returned and the default version behaviour when the Accept-API-Version header is not present on the request.- Returns:
- A new
ResourceApiVersionBehaviourManager
.
-
resourceApiVersionContextFilter
public static Filter resourceApiVersionContextFilter(ResourceApiVersionBehaviourManager behaviourManager)
Creates aFilter
which MUST be placed, in the route, before any API Version routing takes place.The filter will add the required
Context
s, default version behaviour and response headers.- Parameters:
behaviourManager
- AResourceApiVersionBehaviourManager
instance.- Returns:
- A
Filter
instance.
-
resourceApiVersionMatcher
public static RouteMatcher<Version> resourceApiVersionMatcher(Version version)
Creates aRouteMatcher
instance that matches the request resource API version with the provided version.- Parameters:
version
- The API version of the resource.- Returns:
- A
RouteMatcher
instance.
-
requestResourceApiVersionMatcher
public static RouteMatcher<Request> requestResourceApiVersionMatcher(Version version)
Creates aRouteMatcher
instance that matches the request resource API version with the provided version.- Parameters:
version
- The API version of the resource.- Returns:
- A
RouteMatcher
instance.
-
selfApiMatcher
public static RouteMatcher<Request> selfApiMatcher()
A matcher to check if the request is for all versions of the API descriptor of the current path.- Returns:
- A
RouteMatcher
instance.
-
-