Class Connection
- All Implemented Interfaces:
Serializable
,Cloneable
,Header
,NameValuePair
Control options for the current connection and list of hop-by-hop request fields.
Example
Connection: keep-alive Connection: Upgrade
RFC2616 Specification
The Connection general-header field allows the sender to specify options that are desired for that particular connection and MUST NOT be communicated by proxies over further connections.The Connection header has the following grammar:
Connection = "Connection" ":" 1#(connection-token) connection-token = token
HTTP/1.1 proxies MUST parse the Connection header field before a message is forwarded and, for each connection-token in this field, remove any header field(s) from the message with the same name as the connection-token. Connection options are signaled by the presence of a connection-token in the Connection header field, not by any corresponding additional header field(s), since the additional header field may not be sent if there are no parameters associated with that connection option.
Message headers listed in the Connection header MUST NOT include end-to-end headers, such as Cache-Control.
HTTP/1.1 defines the "close" connection option for the sender to signal that the connection will be closed after completion of the response. For example...
Connection: close
...in either the request or the response header fields indicates that the connection SHOULD NOT be considered `persistent' (section 8.1) after the current request/response is complete.
HTTP/1.1 applications that do not support persistent connections MUST include the "close" connection option in every message.
A system receiving an HTTP/1.0 (or lower-version) message that includes a Connection header MUST, for each connection-token in this field, remove and ignore any header field(s) from the message with the same name as the connection-token. This protects against mistaken forwarding of such header fields by pre-HTTP/1.1 proxies. See section 19.6.2.
See Also:
-
Constructor Summary
ConstructorDescriptionConnection
(String value) Constructor.Connection
(Supplier<String> value) Constructor with delayed value. -
Method Summary
Modifier and TypeMethodDescriptionboolean
isClose()
Returnstrue if the header value isclose .boolean
Returnstrue if the header value iskeep-alive .boolean
Returnstrue if the header value isupgrade .static Connection
Static creator.static Connection
Static creator with delayed value.Methods inherited from class org.apache.juneau.http.header.BasicStringHeader
assertString, asString, getValue, of, of, ofPair, orElse
Methods inherited from class org.apache.juneau.http.header.BasicHeader
assertName, assertStringValue, equals, equalsIgnoreCase, get, getElements, getName, hashCode, isNotEmpty, isPresent, of, of, toString
-
Constructor Details
-
Connection
Constructor.- Parameters:
value
- The header value.
Can benull .
-
Connection
Constructor with delayed value.Header value is re-evaluated on each call to
BasicStringHeader.getValue()
.- Parameters:
value
- The supplier of the header value.
Can benull .
-
-
Method Details
-
of
Static creator.- Parameters:
value
- The header value.
Can benull .- Returns:
- A new header bean, or
null if the value isnull .
-
of
Static creator with delayed value.Header value is re-evaluated on each call to
BasicStringHeader.getValue()
.- Parameters:
value
- The supplier of the header value.
Can benull .- Returns:
- A new header bean, or
null if the value isnull .
-
isClose
Returnstrue if the header value isclose .- Returns:
true if the header value isclose .
-
isKeepAlive
Returnstrue if the header value iskeep-alive .- Returns:
true if the header value iskeep-alive .
-
isUpgrade
Returnstrue if the header value isupgrade .- Returns:
true if the header value isupgrade .
-