public final class AcceptApiVersionHeader extends Header
Accept-API-Version
message header.
Represents the accepted protocol and resource versions.Modifier and Type | Field and Description |
---|---|
static String |
NAME
The name of this header.
|
static String |
PROTOCOL
The name of the protocol value component.
|
static String |
RESOURCE
The name of the resource value component.
|
Constructor and Description |
---|
AcceptApiVersionHeader(Version protocol,
Version resource)
Constructs a new header, initialized with the specified protocol and resource versions.
|
Modifier and Type | Method and Description |
---|---|
String |
getName()
Returns the name of the header, as it would canonically appear within an
HTTP message.
|
Version |
getProtocolVersion()
Gets the acceptable protocol version.
|
Version |
getResourceVersion()
Gets the acceptable resource version.
|
List<String> |
getValues()
Returns the header as a list of strings.
|
static AcceptApiVersionHeader |
valueOf(Message<?> message)
Constructs a new header, initialized from the specified message.
|
static AcceptApiVersionHeader |
valueOf(String string)
Constructs a new header, initialized from the specified string value.
|
AcceptApiVersionHeader |
withDefaultProtocolVersion(Version version)
Will set the accepted protocol version, if not provided in the
Accept-API-Version header.
|
AcceptApiVersionHeader |
withDefaultResourceVersion(Version version)
Will set the accepted resource version, if not provided in the
Accept-API-Version header.
|
equals, getFirstValue, hashCode, toString
public static final String NAME
public static final String PROTOCOL
public static final String RESOURCE
public static AcceptApiVersionHeader valueOf(Message<?> message)
message
- The message to initialize the header from.IllegalArgumentException
- If the version header is in an invalid format.public static AcceptApiVersionHeader valueOf(String string)
string
- The value to initialize the header from.IllegalArgumentException
- If the version header is in an invalid format.public String getName()
Header
public Version getProtocolVersion()
public Version getResourceVersion()
public AcceptApiVersionHeader withDefaultProtocolVersion(Version version)
version
- The default protocol version.public AcceptApiVersionHeader withDefaultResourceVersion(Version version)
version
- The default resource version.public List<String> getValues()
Header
String
should represent the value component of the key-value
pair that makes up the HTTP header - as such, for some Header
implementations each String in this List
may contain multiple
token-separated values.
The List
returned from this method should not be expected to be
mutable. However, some subclasses of Header
may choose to
implement it as such.
Copyright © 2010-2018, ForgeRock All Rights Reserved.