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


public interface RoutingContext

Jersey request matching and routing context.

Author:
Marek Potociar (marek.potociar at oracle.com)

Method Summary
 MediaType getEffectiveAcceptableType()
          Get the effective content type of the response calculated from the request Accept header values and @Consumes value of the matched resource method.
 java.lang.String getFinalMatchingGroup()
          Get the final matching group of the last successful request URI routing pattern match result.
 Inflector<Request,Response> getInflector()
          Get the matched request to response data inflector if present, or null otherwise.
 java.util.List<java.util.regex.MatchResult> getMatchedResults()
          Get a read-only list of match results for matched request URI routing patterns.
 java.lang.annotation.Annotation[] getResponseMethodAnnotations()
          Get the annotations on the method ultimately used to process the request.
 java.lang.reflect.Type getResponseMethodType()
          Get the response type of the method ultimately used to process the request.
 java.lang.Object peekMatchedResource()
          Peek the last resource object that successfully matched the request URI.
 java.util.regex.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 pushMatchedResource(java.lang.Object resource)
          Push the resource that matched the request URI.
 void pushMatchResult(java.util.regex.MatchResult matchResult)
          Push the result of the successful request URI routing pattern match.
 void pushTemplate(UriTemplate template)
          Push matched request URI routing pattern URI template.
 void setEffectiveAcceptableType(MediaType type)
          Set the effective content type of the response calculated from the request Accept header values and @Consumes value of the matched resource method.
 void setInflector(Inflector<Request,Response> inflector)
          Set the matched request to response inflector.
 void setResponseMethodAnnotations(java.lang.annotation.Annotation[] annotations)
          Set the annotations on the method ultimately used to process the request.
 void setResponseMethodType(java.lang.reflect.Type responseType)
          Set the response type of the method ultimately used to process the request.
 

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)

peekMatchResult

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

Returns:
last successful request URI routing pattern match result.

pushTemplate

void pushTemplate(UriTemplate template)
Push matched request URI routing pattern URI template.

Parameters:
template - URI template of the matched request URI routing pattern.

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.

getMatchedResults

java.util.List<java.util.regex.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.


getEffectiveAcceptableType

MediaType getEffectiveAcceptableType()
Get the effective content type of the response calculated from the request Accept header values and @Consumes value of the matched resource method. May return null if no method was yet matched.

Returns:
effective accepted media type. May return null if no resource method was yet matched.

setEffectiveAcceptableType

void setEffectiveAcceptableType(MediaType type)
                                throws java.lang.NullPointerException
Set the effective content type of the response calculated from the request Accept header values and @Consumes value of the matched resource method. The input value must not be null otherwise a NullPointerException is thrown.

Parameters:
type - new effective accepted media type.
Throws:
java.lang.NullPointerException - in case the input parameter is null.

setResponseMethodType

void setResponseMethodType(java.lang.reflect.Type responseType)
                           throws java.lang.NullPointerException
Set the response type of the method ultimately used to process the request.

Parameters:
responseType - response type.
Throws:
java.lang.NullPointerException - in case the input parameter is null.

getResponseMethodType

java.lang.reflect.Type getResponseMethodType()
Get the response type of the method ultimately used to process the request.

Returns:
processing method response type.

setResponseMethodAnnotations

void setResponseMethodAnnotations(java.lang.annotation.Annotation[] annotations)
                                  throws java.lang.NullPointerException
Set the annotations on the method ultimately used to process the request.

Parameters:
annotations - response method annotations.
Throws:
java.lang.NullPointerException - in case the input parameter is null.

getResponseMethodAnnotations

java.lang.annotation.Annotation[] getResponseMethodAnnotations()
Get the annotations on the method ultimately used to process the request.

Returns:
processing method annotations.

setInflector

void setInflector(Inflector<Request,Response> 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<Request,Response> 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.


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.