Class ApiVersionRouterContext

java.lang.Object
org.forgerock.services.context.AbstractContext
org.forgerock.http.routing.ApiVersionRouterContext
All Implemented Interfaces:
Context

public class ApiVersionRouterContext extends AbstractContext
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
  • 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

      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 - The ClassLoader which can properly resolve the persisted class-name.
  • Method Details

    • 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:
      true if 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.