public final class WarningHeader extends Header
Modifier and Type | Field and Description |
---|---|
static int |
DISCONNECTED_OPERATION
112 Disconnected operation SHOULD be included if the cache is
intentionally disconnected from the rest of the network for a period of
time.
|
static int |
HEURISTIC_EXPIRATION
113 Heuristic expiration MUST be included if the cache heuristically
chose a freshness lifetime greater than 24 hours and the response's age
is greater than 24 hours.
|
static int |
MISCELLANEOUS_PERSISTENT_WARNING
299 Miscellaneous persistent warning The warning text MAY include
arbitrary information to be presented to a human user, or logged.
|
static int |
MISCELLANEOUS_WARNING
199 Miscellaneous warning The warning text MAY include arbitrary
information to be presented to a human user, or logged.
|
static String |
NAME
The name of this header.
|
static int |
NOT_PRESENT
100 Indicates that there is data missing from the request.
|
static int |
RESPONSE_STALE
110 Response is stale MUST be included whenever the returned response
is stale.
|
static int |
REVALIDATION_FAILED
111 Revalidation failed MUST be included if a cache returns a stale
response because an attempt to revalidate the response failed, due to an
inability to reach the server.
|
static int |
TRANFORMATION_APPLIED
214 Transformation applied MUST be added by an intermediate cache or
proxy if it applies any transformation changing the content-coding (as
specified in the Content-Encoding header) or media-type (as specified in
the Content-Type header) of the response, or the entity-body of the
response, unless this Warning code already appears in the response.
|
Constructor and Description |
---|
WarningHeader(List<Warning> warnings)
Constructor for multiple
Warning s. |
WarningHeader(Warning warning)
Constructor for single
Warning . |
Modifier and Type | Method and Description |
---|---|
WarningHeader |
add(int code,
String agent,
String text)
Constructs a new header with the warnings defined in this
WarningHeader in addition to the provided warning. |
WarningHeader |
add(int code,
String agent,
String text,
Date date)
Constructs a new header with the warnings defined in this
WarningHeader in addition to the provided warning. |
WarningHeader |
add(Warning warning)
Constructs a new header with the warnings defined in this
WarningHeader in addition to the provided warning. |
boolean |
equals(Object o) |
String |
getName()
Returns the name of the header, as it would canonically appear within an
HTTP message.
|
List<String> |
getValues()
Returns the header as a list of strings.
|
List<Warning> |
getWarnings()
Gets all
Warning s. |
int |
hashCode() |
static WarningHeader |
newWarning(String agentName,
String fmt,
Object... args)
Constructs a new warning header with the frequently-used error type:
100.
|
protected static List<Warning> |
toWarnings(List<String> headers)
Matches warning-headers from a
List of header-values. |
static WarningHeader |
valueOf(Message<?> message)
Constructs a new header, initialized from the specified message.
|
static WarningHeader |
valueOf(String header)
Constructs a new header, initialized from the specified string value.
|
getFirstValue, toString
public static final String NAME
public static final int NOT_PRESENT
ForgeRock-Specific.
public static final int RESPONSE_STALE
public static final int REVALIDATION_FAILED
public static final int DISCONNECTED_OPERATION
public static final int HEURISTIC_EXPIRATION
public static final int MISCELLANEOUS_WARNING
public static final int TRANFORMATION_APPLIED
public static final int MISCELLANEOUS_PERSISTENT_WARNING
public WarningHeader(Warning warning)
Warning
.warning
- Single Warning
public static WarningHeader valueOf(Message<?> message)
message
- The message to initialize the header from.public static WarningHeader valueOf(String header)
header
- The value to initialize the header from.protected static List<Warning> toWarnings(List<String> headers)
List
of header-values.headers
- Array of header valuesheaders
that are a valid warning-headerpublic static WarningHeader newWarning(String agentName, String fmt, Object... args)
agentName
- Name of the component responsible for issuing the
warning.fmt
- The format, which may include embedded %s, etc.args
- Zero or more args, passed into String.format to generate the
warning text.WarningHeader
indicating the
expected key was not found in the request.public String getName()
Header
public WarningHeader add(int code, String agent, String text)
WarningHeader
in addition to the provided warning.code
- The warning code.agent
- Name of the component responsible for issuing the warning.text
- The warning text.WarningHeader
instance.public WarningHeader add(int code, String agent, String text, Date date)
WarningHeader
in addition to the provided warning.code
- The warning code.agent
- Name of the component responsible for issuing the warning.text
- The warning text.date
- The warning date or null
.WarningHeader
instance.public WarningHeader add(Warning warning)
WarningHeader
in addition to the provided warning.warning
- The warning.WarningHeader
instance.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.