org.glassfish.jersey.server.internal.routing
Interface RoutingContext

All Superinterfaces:
javax.ws.rs.container.ResourceInfo
All Known Implementing Classes:
UriRoutingContext

public interface RoutingContext
extends javax.ws.rs.container.ResourceInfo

Jersey request matching and routing context.

Author:
Marek Potociar (marek.potociar at oracle.com), Martin Matula (martin.matula at oracle.com)

Method Summary
 Iterable<javax.ws.rs.ext.ReaderInterceptor> getBoundReaderInterceptors()
          Get all reader interceptors applicable to this request.
 Iterable<RankedProvider<javax.ws.rs.container.ContainerRequestFilter>> getBoundRequestFilters()
          Get all bound request filters applicable to this request.
 Iterable<RankedProvider<javax.ws.rs.container.ContainerResponseFilter>> getBoundResponseFilters()
          Get all bound response filters applicable to this request.
 Iterable<javax.ws.rs.ext.WriterInterceptor> getBoundWriterInterceptors()
          Get all writer interceptors applicable to this request.
 String getFinalMatchingGroup()
          Get the final matching group of the last successful request URI routing pattern match result.
 Inflector<ContainerRequest,ContainerResponse> getInflector()
          Get the matched request to response data inflector if present, or null otherwise.
 List<MatchResult> getMatchedResults()
          Get a read-only list of match results for matched request URI routing patterns.
 Object peekMatchedResource()
          Peek the last resource object that successfully matched the request URI.
 MatchResult peekMatchResult()
          Peek at the last successful request URI routing pattern match result.
 void pushLeftHandPath()
          Add currently matched left-hand side part of request path to the list of matched paths returned by UriInfo.getMatchedURIs().
 void pushLocatorSubResource(Resource subResourceFromLocator)
          Push sub resource returned from a sub resource locator method.
 void pushMatchedLocator(ResourceMethod resourceLocator)
          Push the matched sub resource locator method.
 void pushMatchedResource(Object resource)
          Push the resource that matched the request URI.
 void pushMatchedRuntimeResource(RuntimeResource runtimeResource)
          Push a matched runtime 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 pattern templates for a single matched method.
 void setInflector(Inflector<ContainerRequest,ContainerResponse> inflector)
          Set the matched request to response inflector.
 void setMatchedResourceMethod(ResourceMethod resourceMethod)
          Set the matched resource method.
 
Methods inherited from interface javax.ws.rs.container.ResourceInfo
getResourceClass, getResourceMethod
 

Method Detail

pushMatchResult

void pushMatchResult(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(Object resource)
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)

peekMatchResult

MatchResult peekMatchResult()
Peek at the last successful request URI routing pattern match result.

Returns:
last successful request URI routing pattern match result.

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

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.

getMatchedResults

List<MatchResult> getMatchedResults()
Get a read-only list of match results for matched request URI routing patterns. Entries are ordered in reverse request URI matching order, with the root request URI routing pattern match result last.

Returns:
a read-only reverse list of request URI routing pattern match results.

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.


setInflector

void setInflector(Inflector<ContainerRequest,ContainerResponse> inflector)
Set the matched request to response inflector.

This method can be used in a non-terminal stage to set the inflector that can be retrieved and processed by a subsequent stage.

Parameters:
inflector - matched request to response inflector.

getInflector

Inflector<ContainerRequest,ContainerResponse> getInflector()
Get the matched request to response data inflector if present, or null otherwise.

Returns:
matched request to response inflector, or null if not available.

getBoundRequestFilters

Iterable<RankedProvider<javax.ws.rs.container.ContainerRequestFilter>> getBoundRequestFilters()
Get all bound request filters applicable to this request.

Returns:
All bound (dynamically or by name) request filters applicable to the matched inflector (or an empty collection if no inflector matched yet).

getBoundResponseFilters

Iterable<RankedProvider<javax.ws.rs.container.ContainerResponseFilter>> getBoundResponseFilters()
Get all bound response filters applicable to this request. This is populated once the right resource method is matched.

Returns:
All bound (dynamically or by name) response filters applicable to the matched inflector (or an empty collection if no inflector matched yet).

getBoundReaderInterceptors

Iterable<javax.ws.rs.ext.ReaderInterceptor> getBoundReaderInterceptors()
Get all reader interceptors applicable to this request. This is populated once the right resource method is matched.

Returns:
All reader interceptors applicable to the matched inflector (or an empty collection if no inflector matched yet).

getBoundWriterInterceptors

Iterable<javax.ws.rs.ext.WriterInterceptor> getBoundWriterInterceptors()
Get all writer interceptors applicable to this request.

Returns:
All writer interceptors applicable to the matched inflector (or an empty collection if no inflector matched yet).

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.

pushMatchedLocator

void pushMatchedLocator(ResourceMethod resourceLocator)
Push the matched sub resource locator method.

Parameters:
resourceLocator - Sub resource locator method.

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.


Copyright © 2007-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.