Interface RoutingContext
- All Superinterfaces:
ExtendedUriInfo
,ResourceInfo
,UriInfo
- All Known Implementing Classes:
UriRoutingContext
Jersey request matching and routing context.
- Author:
- Marek Potociar, Martin Matula
-
Method Summary
Modifier and TypeMethodDescriptionGet the matched server-side endpoint if present, ornull
otherwise.Get the final matching group of the last successful request URI routing patternmatch result
.Peek the last resource object that successfully matched the request URI.void
Add currently matched left-hand side part of request path to the list of matched paths returned byUriInfo.getMatchedURIs()
.void
pushLocatorSubResource
(Resource subResourceFromLocator) Pushsub resource
returned from a sub resource locator method.void
pushMatchedLocator
(ResourceMethod resourceLocator) Push the matchedsub resource locator method
.void
pushMatchedResource
(Object resource) Push the resource that matched the request URI.void
pushMatchedRuntimeResource
(RuntimeResource runtimeResource) Push a matchedruntime resource
that was visited during matching phase.void
pushMatchResult
(MatchResult matchResult) Push the result of the successful request URI routing pattern match.void
pushTemplates
(UriTemplate resourceTemplate, UriTemplate methodTemplate) Push matched request URI routing patterntemplates
for a single matched method.void
setEndpoint
(Endpoint endpoint) Set the matched server-side endpoint.void
setMappedThrowable
(Throwable throwable) Set the throwable that was mapped to a response.void
setMatchedResourceMethod
(ResourceMethod resourceMethod) Set the matchedresource method
.Methods inherited from interface org.glassfish.jersey.server.ExtendedUriInfo
getLocatorSubResources, getMappedThrowable, getMatchedModelResource, getMatchedResourceLocators, getMatchedResourceMethod, getMatchedResults, getMatchedRuntimeResources, getMatchedTemplates, getPathSegments, getPathSegments
Methods inherited from interface jakarta.ws.rs.container.ResourceInfo
getResourceClass, getResourceMethod
Methods inherited from interface jakarta.ws.rs.core.UriInfo
getAbsolutePath, getAbsolutePathBuilder, getBaseUri, getBaseUriBuilder, getMatchedResources, getMatchedURIs, getMatchedURIs, getPath, getPath, getPathParameters, getPathParameters, getPathSegments, getPathSegments, getQueryParameters, getQueryParameters, getRequestUri, getRequestUriBuilder, relativize, resolve
-
Method Details
-
pushMatchResult
Push the result of the successful request URI routing pattern match.- Parameters:
matchResult
- successful request URI routing patternmatch result
.
-
pushMatchedResource
Push the resource that matched the request URI.- Parameters:
resource
- instance of the resource that matched the request URI.
-
peekMatchedResource
Object peekMatchedResource()Peek the last resource object that successfully matched the request URI.- Returns:
- last resource matched as previously set by
pushMatchedResource(java.lang.Object)
-
pushTemplates
Push matched request URI routing patterntemplates
for a single matched method.In case only a single path matching has been performed on the resource (in case of resource methods, only the resource path is matched), the method template should be passed as
null
. In case a path matching has been performed on both a resource and method paths (in case of sub-resource methods and locators), both templates (resource and method) must be specified.- Parameters:
resourceTemplate
- resource URI template that should be pushed.methodTemplate
- (sub-resource) method or locator URI template that should be pushed.
-
getFinalMatchingGroup
String getFinalMatchingGroup()Get the final matching group of the last successful request URI routing patternmatch result
. Also known as right-hand path.May be empty but is never
null
.- Returns:
- final matching group of the last successful request URI routing pattern match result.
-
pushLeftHandPath
void pushLeftHandPath()Add currently matched left-hand side part of request path to the list of matched paths returned byUriInfo.getMatchedURIs()
. Left-hand side request path is the request path excluding the suffix part of the path matched by thefinal matching group
of the last successful request URI routing pattern. -
setEndpoint
Set the matched server-side endpoint. This method can be used in a non-terminal stage to set the server-side endpoint that can be retrieved and processed by a subsequent stage.- Parameters:
endpoint
- matched server-side endpoint.
-
getEndpoint
Endpoint getEndpoint()Get the matched server-side endpoint if present, ornull
otherwise.- Returns:
- matched server-side endpoint, or
null
if not available.
-
setMatchedResourceMethod
Set the matchedresource method
. This method needs to be called only if the method was matched. This method should be called only for setting the final resource method and not for setting sub resource locators invoked during matching.- Parameters:
resourceMethod
- Resource method that was matched.
-
pushMatchedLocator
Push the matchedsub resource locator method
.- Parameters:
resourceLocator
- Sub resource locator method.
-
pushMatchedRuntimeResource
Push a matchedruntime resource
that was visited during matching phase. This method must be called for any matched runtime resource.- Parameters:
runtimeResource
- Runtime resource that was matched during matching.
-
pushLocatorSubResource
Pushsub resource
returned from a sub resource locator method. The pushedsubResourceFromLocator
is the final model of a sub resource which is already enhanced bymodel processors
and validated.- Parameters:
subResourceFromLocator
- Resource constructed from result of sub resource locator method.
-
setMappedThrowable
Set the throwable that was mapped to a response.- Parameters:
throwable
- throwable that was mapped to a response.- See Also:
-