@Contract(threading=IMMUTABLE) public final class ProxyStatus extends Object
Proxy-Status response field defined by RFC 9209. Each member
identifies one intermediary and carries the parameters that describe how that intermediary
handled the request.
This type is a passive, immutable data holder. It neither interprets nor acts on the reported
values; callers decide whether and how to use them. Parameter values keep their Structured
Fields (RFC 8941) types: a ProxyStatus.Token for tokens, a String for strings, a
Long for integers, a BigDecimal for decimals, a Boolean for
booleans and a byte[] for byte sequences. Byte-sequence values are defensively copied
on the way in and out, so instances remain immutable. Parsing of the field value is performed
by ProxyStatusSupport.
| Modifier and Type | Class and Description |
|---|---|
static class |
ProxyStatus.Token
An RFC 8941 Token value, kept distinct from
String so that Token and String
parameter values are not conflated. |
| Constructor and Description |
|---|
ProxyStatus(String name,
Map<String,Object> parameters)
Creates a member with the given intermediary identity and parameters.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getDetails()
Returns the free-form
details string, or null when the parameter is absent. |
ProxyStatusError |
getError()
Returns the standardized
error, or null when the parameter is absent or its
token is not registered by RFC 9209. |
String |
getErrorToken()
Returns the raw
error token, or null when the parameter is absent or not a
token. |
String |
getName()
Returns the identity of the intermediary, that is, the value of the list member.
|
String |
getNextHop()
Returns the
next-hop value, or null when the parameter is absent. |
String |
getNextProtocol()
Returns the
next-protocol ALPN identifier when it is expressed as a token, or
null when the parameter is absent or expressed as a byte sequence. |
Object |
getParameter(String name)
Returns the value of the named parameter, or
null when it is absent. |
Map<String,Object> |
getParameters()
Returns the parameters attached to this member as an unmodifiable map in parsed order.
|
Integer |
getReceivedStatus()
Returns the
received-status code, or null when the parameter is absent or
not an integer. |
String |
toString() |
public ProxyStatus(String name, Map<String,Object> parameters)
byte[] values are cloned, so the instance cannot be mutated through
the supplied map. To keep the instance immutable, each value must be one of the supported
Structured Fields types (ProxyStatus.Token, String, Long, BigDecimal,
Boolean or byte[]); any other value is rejected.name - the identity of the intermediary; must not be null.parameters - the member parameters, or null for none.IllegalArgumentException - if a parameter value is not a supported type.public String getName()
public Map<String,Object> getParameters()
byte[] value is cloned, so mutating it does not affect this instance.public Object getParameter(String name)
null when it is absent. A byte[]
value is cloned before being returned.public String getErrorToken()
error token, or null when the parameter is absent or not a
token.public ProxyStatusError getError()
error, or null when the parameter is absent or its
token is not registered by RFC 9209.public String getNextHop()
next-hop value, or null when the parameter is absent. The
parameter may be a string or a token; both are returned as their character value.public String getNextProtocol()
next-protocol ALPN identifier when it is expressed as a token, or
null when the parameter is absent or expressed as a byte sequence. A byte-sequence
identifier is available as a byte[] through getParameter(String).public Integer getReceivedStatus()
received-status code, or null when the parameter is absent or
not an integer. The value is validated as an HTTP status code during parsing, so it always
fits in an int.public String getDetails()
details string, or null when the parameter is absent.Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.