Package org.forgerock.http.routing
Class ApiVersionRouterContext
- java.lang.Object
 - 
- org.forgerock.services.context.AbstractContext
 - 
- org.forgerock.http.routing.ApiVersionRouterContext
 
 
 
- 
- All Implemented Interfaces:
 Context
public class ApiVersionRouterContext extends AbstractContext
AContextwhich is created when a request is and has been routed based on resource API version. The context includes:- the default version behaviour, if the request does not contain a resource API version
 - whether a warning is issued to the client, if the request does not contain a resource API version
 - the API version of the framework that was used to handle the request
 - the API version of the resource that was routed to
 
 
- 
- 
Field Summary
- 
Fields inherited from class org.forgerock.services.context.AbstractContext
data 
 - 
 
- 
Constructor Summary
Constructors Constructor Description ApiVersionRouterContext(JsonValue savedContext, ClassLoader classLoader)Restore from JSON representation.ApiVersionRouterContext(Context parent, DefaultVersionBehaviour defaultVersionBehaviour, boolean warningEnabled)Creates a new resource API version routing context having the provided parent, default versioning behaviour and whether warnings will be issued. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultVersionBehaviourgetDefaultVersionBehaviour()Gets the default version behaviour if the request does not contain a resource API version.VersiongetProtocolVersion()Gets the protocol API version of the framework used to handle the request.VersiongetResourceVersion()Gets the API version of the resource that the request was routed to.booleanisWarningEnabled()Gets whether a warning should be issued to the calling client if the request does not contain a resource API version.voidsetProtocolVersion(Version protocolVersion)Sets the protocol API version of the framework used to handle the request.- 
Methods inherited from class org.forgerock.services.context.AbstractContext
as, asContext, containsContext, containsContext, get, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
ApiVersionRouterContext
public ApiVersionRouterContext(Context parent, DefaultVersionBehaviour defaultVersionBehaviour, boolean warningEnabled)
Creates a new resource API version routing context having the provided parent, default versioning behaviour and whether warnings will be issued.- Parameters:
 parent- The parent context.defaultVersionBehaviour- The default version behaviour.warningEnabled- Whether warnings will be issued to the client.
 
- 
ApiVersionRouterContext
public ApiVersionRouterContext(JsonValue savedContext, ClassLoader classLoader)
Restore from JSON representation.- Parameters:
 savedContext- The JSON representation from which this context's attributes should be parsed.classLoader- TheClassLoaderwhich can properly resolve the persisted class-name.
 
 - 
 
- 
Method Detail
- 
getDefaultVersionBehaviour
public DefaultVersionBehaviour getDefaultVersionBehaviour()
Gets the default version behaviour if the request does not contain a resource API version.- Returns:
 - The default version behaviour.
 
 
- 
isWarningEnabled
public boolean isWarningEnabled()
Gets whether a warning should be issued to the calling client if the request does not contain a resource API version.- Returns:
 trueif warnings should be issued to the client.
 
- 
setProtocolVersion
public void setProtocolVersion(Version protocolVersion)
Sets the protocol API version of the framework used to handle the request.- Parameters:
 protocolVersion- The framework protocol API version.
 
- 
getProtocolVersion
public Version getProtocolVersion()
Gets the protocol API version of the framework used to handle the request.- Returns:
 - The framework protocol API version.
 
 
- 
getResourceVersion
public Version getResourceVersion()
Gets the API version of the resource that the request was routed to.- Returns:
 - The resource API version.
 
 
 - 
 
 -