Interface ExtendedUriInfo

All Superinterfaces:
UriInfo
All Known Subinterfaces:
RoutingContext
All Known Implementing Classes:
UriRoutingContext

public interface ExtendedUriInfo extends UriInfo
Extensions to UriInfo.
Author:
Paul Sandoz
  • Method Details

    • getMappedThrowable

      Throwable getMappedThrowable()
      Get the throwable that was mapped to a response.

      A response filter or a message body writer may utilize this method to determine if a resource method was invoked but did not return a response because an exception was thrown from the resource method, or the resource method returned but a response filter threw an exception.

      Returns:
      the throwable that was mapped to a response, otherwise null if no throwable was mapped to a response.
    • getMatchedResults

      List<MatchResult> getMatchedResults()
      Get a read-only list of MatchResult for matched resources. Entries are ordered in reverse request URI matching order, with the root resource match result last.
      Returns:
      a read-only list of match results for matched resources.
    • getMatchedTemplates

      List<UriTemplate> getMatchedTemplates()
      Get a read-only list of UriTemplate for matched resources. Each entry is a URI template that is the value of the Path that is a partial path that matched a resource class, a sub-resource method or a sub-resource locator. Entries are ordered in reverse request URI matching order, with the root resource URI template last.
      Returns:
      a read-only list of URI templates for matched resources.
    • getPathSegments

      List<PathSegment> getPathSegments(String name)
      Get the path segments that contain a template variable. All sequences of escaped octets are decoded, equivalent to getPathSegments(true).
      Parameters:
      name - the template variable name
      Returns:
      the path segments, the list will be empty the matching path does not contain the template
    • getPathSegments

      List<PathSegment> getPathSegments(String name, boolean decode)
      Get the path segments that contain a template variable.
      Parameters:
      name - the template variable name
      decode - controls whether sequences of escaped octets are decoded (true) or not (false).
      Returns:
      the path segments, the list will be empty the matching path does not contain the template
    • getMatchedRuntimeResources

      List<RuntimeResource> getMatchedRuntimeResources()
      Return all matched runtime resources including runtime resources based on child resources. The list is ordered so that the runtime resource currently being processed is the first element in the list.

      The following example

      @Path("foo")
       public class FooResource {
        @GET
        public String getFoo() {...}
      
        @Path("bar")
        public BarResource getBarResource() {...}
       }
      
       public class BarResource {
        @GET
        public String getBar() {...}
       }
       

      The values returned by this method based on request uri and where the method is called from are:

      Request Called from Value(s)
      GET /foo FooResource.getFoo RuntimeResource["/foo"]
      GET /foo/bar FooResource.getBarResource RuntimeResource["foo/bar"], Resource["foo"]
      GET /foo/bar BarResource.getBar RuntimeResource[no path; based on BarResource.class], RuntimeResource["foo/bar"], RuntimeResource["foo"]
      Returns:
      List of resources and child resources that were processed during request matching.
    • getMatchedResourceMethod

      ResourceMethod getMatchedResourceMethod()
      Get matched resource method that is invoked.

      Note that sub resource locator is not not considered as a matched resource method and calling the method from sub resource locator will therefore return null.

      Returns:
      The matched resource method that was invoked or null if no resource method was invoked.
    • getMatchedModelResource

      Resource getMatchedModelResource()
      Get matched model resource from which the matched resource method was invoked. The resource can also be a child if the matched method is a sub resource method.

      Note that method return only resource containing finally matched resource method and not intermediary processed resources (parent resources or resources containing sub resource locators).

      Returns:
      The matched model resource or null if no resource was matched.
    • getMatchedResourceLocators

      List<ResourceMethod> getMatchedResourceLocators()
      Get resource locators matched since beginning of a matching. The list contains resource locators sorted in the order that the first element of the list is the last locator executed (LIFO ordering). The method can be invoked from request scoped code. When method is invoked from the resource locator itself such a locator will be already in the returned list as a first element.

      The resource locator is a resource method which is annotated by the @Path and returns a sub resource.

      Returns:
      List of matched resource locators.
    • getLocatorSubResources

      List<Resource> getLocatorSubResources()
      Get the list of sub resources returned from resource locators during matching. The sub resources are sorted in the order, so that the first element of the list is a sub resource that was lastly returned from the resource locator (LIFO ordering).

      Sub resource is a resource that is returned from invoked resource locator method and that will be used for further resource matching.

      Returns:
      Locator sub resource.