public abstract static class HttpHeader.Builder<T extends HttpHeader.Builder>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Boolean |
chunked |
protected java.lang.Long |
contentLength |
protected java.lang.String |
contentType |
protected MimeHeaders |
mimeHeaders |
protected Protocol |
protocol |
protected java.lang.String |
protocolString |
protected java.lang.String |
upgrade |
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
HttpHeader |
build() |
T |
chunked(boolean chunked)
Set true, if this
HttpPacket content will be transferred
in chunking mode, or false if case of fixed-length message. |
T |
contentLength(long contentLength)
Set the content-length of this
HttpPacket. |
T |
contentType(java.lang.String contentType)
Set the content-type of this
HttpPacket. |
protected abstract HttpHeader |
create() |
T |
header(Header header,
java.lang.String value)
Add the HTTP mime header.
|
T |
header(java.lang.String name,
java.lang.String value)
Add the HTTP mime header.
|
T |
maxNumHeaders(int maxHeaders)
Sets the maximum number of headers allowed.
|
T |
protocol(Protocol protocol)
Set the HTTP message protocol version.
|
T |
protocol(java.lang.String protocolString)
Set the HTTP message protocol version.
|
T |
removeHeader(Header header)
Remove the specified header from this builder.
|
T |
removeHeader(java.lang.String header)
Remove the specified header from this builder.
|
void |
reset() |
T |
upgrade(java.lang.String upgrade)
Set the HTTP upgrade type.
|
protected Protocol protocol
protected java.lang.String protocolString
protected java.lang.Boolean chunked
protected java.lang.Long contentLength
protected java.lang.String contentType
protected java.lang.String upgrade
protected MimeHeaders mimeHeaders
public final T protocol(Protocol protocol)
protocol - Protocolpublic final T protocol(java.lang.String protocolString)
protocolString - protocol version in format "HTTP/1.x".public final T chunked(boolean chunked)
HttpPacket content will be transferred
in chunking mode, or false if case of fixed-length message.chunked - true, if this HttpPacket content
will be transferred in chunking mode, or false if case
of fixed-length message.public final T contentLength(long contentLength)
HttpPacket. Applicable only in case
of fixed-length HTTP message.contentLength - the content-length of this HttpPacket.
Applicable only in case of fixed-length HTTP message.public final T contentType(java.lang.String contentType)
HttpPacket.contentType - the content-type of this HttpPacket.public final T upgrade(java.lang.String upgrade)
upgrade - the type of upgrade.public final T header(java.lang.String name, java.lang.String value)
name - the mime header name.value - the mime header value.public final T removeHeader(java.lang.String header)
header - the mime header.public final T header(Header header, java.lang.String value)
header - the mime Header.value - the mime header value.public final T removeHeader(Header header)
header - the mime Header.public final T maxNumHeaders(int maxHeaders)
public HttpHeader build()
public void reset()
protected abstract HttpHeader create()
Copyright © 2018 Oracle Corporation. All Rights Reserved.