Package org.forgerock.http.routing
Class ApiVersionRouterContext
java.lang.Object
org.forgerock.services.context.AbstractContext
org.forgerock.http.routing.ApiVersionRouterContext
- All Implemented Interfaces:
Context
A
Context
which 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
ConstructorDescriptionApiVersionRouterContext
(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
Modifier and TypeMethodDescriptionGets the default version behaviour if the request does not contain a resource API version.Gets the protocol API version of the framework used to handle the request.Gets the API version of the resource that the request was routed to.boolean
Gets whether a warning should be issued to the calling client if the request does not contain a resource API version.void
setProtocolVersion
(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 Details
-
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
Restore from JSON representation.- Parameters:
savedContext
- The JSON representation from which this context's attributes should be parsed.classLoader
- TheClassLoader
which can properly resolve the persisted class-name.
-
-
Method Details
-
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:
true
if warnings should be issued to the client.
-
setProtocolVersion
Sets the protocol API version of the framework used to handle the request.- Parameters:
protocolVersion
- The framework protocol API version.
-
getProtocolVersion
Gets the protocol API version of the framework used to handle the request.- Returns:
- The framework protocol API version.
-
getResourceVersion
Gets the API version of the resource that the request was routed to.- Returns:
- The resource API version.
-