public class ConnectionOptions extends ObjectWithJsonToString
Constructor and Description |
---|
ConnectionOptions() |
Modifier and Type | Method and Description |
---|---|
static ConnectionOptions |
connectionOptions() |
Integer |
getChunkSize() |
Boolean |
getCloseSocket() |
Delay |
getCloseSocketDelay() |
Integer |
getContentLengthHeaderOverride() |
Boolean |
getKeepAliveOverride() |
Boolean |
getSuppressConnectionHeader() |
Boolean |
getSuppressContentLengthHeader() |
static boolean |
isFalseOrNull(Boolean aBoolean) |
ConnectionOptions |
withChunkSize(Integer chunkSize)
Specifies the size of chunks in a response:
|
ConnectionOptions |
withCloseSocket(Boolean closeSocket)
Override whether the socket is closed after a response is sent:
if true the socket will always be closed,
if false the socket will never be closed,
if not set the socket will be closed unless the request received is HTTP 1.1 and contains a "Connection" header with a value of "keep-alive"
|
ConnectionOptions |
withCloseSocketDelay(Delay closeSocketDelay)
Override how long to delay before closing socket, this value is ignored if socket isn't going to be closed
|
ConnectionOptions |
withContentLengthHeaderOverride(Integer contentLengthHeaderOverride)
Override the "Content-Length" header with the specified amount, if not set the "Content-Length"
header will have a value determined by the length of the body
|
ConnectionOptions |
withKeepAliveOverride(Boolean keepAliveOverride)
Override the "Connection" header:
if true the "Connection" header is specified with a value of "keep-alive"
if false the "Connection" header is specified with a value of "close"
if not set the "Connection" header will have a a value of "close" unless the request received is HTTP 1.1 and contains a "Connection" header with a value of "keep-alive"
|
ConnectionOptions |
withSuppressConnectionHeader(Boolean suppressConnectionHeader)
Prevent a "Connection" header from being added to the response
|
ConnectionOptions |
withSuppressContentLengthHeader(Boolean suppressContentLengthHeader)
Prevent a "Content-Length" header from being added to the response
|
toString
equals, fieldsExcludedFromEqualsAndHashCode, hashCode
public static ConnectionOptions connectionOptions()
public static boolean isFalseOrNull(Boolean aBoolean)
public ConnectionOptions withSuppressContentLengthHeader(Boolean suppressContentLengthHeader)
suppressContentLengthHeader
- if true no "Content-Length" header will be added to the responsepublic Boolean getSuppressContentLengthHeader()
public ConnectionOptions withContentLengthHeaderOverride(Integer contentLengthHeaderOverride)
contentLengthHeaderOverride
- the value to use for the "Content-Length" headerpublic Integer getContentLengthHeaderOverride()
public ConnectionOptions withSuppressConnectionHeader(Boolean suppressConnectionHeader)
suppressConnectionHeader
- if true no "Connection" header will be added to the responsepublic Boolean getSuppressConnectionHeader()
public ConnectionOptions withChunkSize(Integer chunkSize)
If null (the default value), zero or negative then response will not be chunked If positive and non-null the response will have "Transfer-Encoding: chunked" header and will be chunked into chunks of the size specified (as long as the body is large enough)
chunkSize
- the size of response chunks, if null response will not be chunkedpublic Integer getChunkSize()
public ConnectionOptions withKeepAliveOverride(Boolean keepAliveOverride)
keepAliveOverride
- if true "keep-alive" is used if false "close" is used for the "Connection" headerpublic Boolean getKeepAliveOverride()
public ConnectionOptions withCloseSocket(Boolean closeSocket)
closeSocket
- set whether the socket is closed after a response is sentpublic Boolean getCloseSocket()
public ConnectionOptions withCloseSocketDelay(Delay closeSocketDelay)
closeSocketDelay
- set delay before closing socketpublic Delay getCloseSocketDelay()
Copyright © 2020. All rights reserved.