Interface RoutingContext

  • All Superinterfaces:
    ExtendedUriInfo, javax.ws.rs.container.ResourceInfo, javax.ws.rs.core.UriInfo
    All Known Implementing Classes:
    UriRoutingContext

    public interface RoutingContext
    extends javax.ws.rs.container.ResourceInfo, ExtendedUriInfo
    Jersey request matching and routing context.
    • Method Detail

      • pushMatchResult

        void pushMatchResult​(java.util.regex.MatchResult matchResult)
        Push the result of the successful request URI routing pattern match.
        Parameters:
        matchResult - successful request URI routing pattern match result.
      • pushMatchedResource

        void pushMatchedResource​(java.lang.Object resource)
        Push the resource that matched the request URI.
        Parameters:
        resource - instance of the resource that matched the request URI.
      • peekMatchedResource

        java.lang.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

        void pushTemplates​(UriTemplate resourceTemplate,
                           UriTemplate methodTemplate)
        Push matched request URI routing pattern templates 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

        java.lang.String getFinalMatchingGroup()
        Get the final matching group of the last successful request URI routing pattern match 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 by UriInfo.getMatchedURIs().

        Left-hand side request path is the request path excluding the suffix part of the path matched by the final matching group of the last successful request URI routing pattern.

      • setEndpoint

        void setEndpoint​(Endpoint endpoint)
        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, or null otherwise.
        Returns:
        matched server-side endpoint, or null if not available.
      • setMatchedResourceMethod

        void setMatchedResourceMethod​(ResourceMethod resourceMethod)
        Set the matched resource 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.
      • pushMatchedRuntimeResource

        void pushMatchedRuntimeResource​(RuntimeResource runtimeResource)
        Push a matched runtime 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

        void pushLocatorSubResource​(Resource subResourceFromLocator)
        Push sub resource returned from a sub resource locator method. The pushed subResourceFromLocator is the final model of a sub resource which is already enhanced by model processors and validated.
        Parameters:
        subResourceFromLocator - Resource constructed from result of sub resource locator method.
      • setMappedThrowable

        void setMappedThrowable​(java.lang.Throwable throwable)
        Set the throwable that was mapped to a response.
        Parameters:
        throwable - throwable that was mapped to a response.
        See Also:
        ExtendedUriInfo.getMappedThrowable()