public abstract static class HttpHeader.Builder<T extends HttpHeader.Builder> extends Object
Modifier and Type | Field and Description |
---|---|
protected Boolean |
chunked |
protected Long |
contentLength |
protected String |
contentType |
protected MimeHeaders |
mimeHeaders |
protected Protocol |
protocol |
protected String |
protocolString |
protected 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(String contentType)
Set the content-type of this
HttpPacket . |
protected abstract HttpHeader |
create() |
T |
header(Header header,
String value)
Add the HTTP mime header.
|
T |
header(String name,
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(String protocolString)
Set the HTTP message protocol version.
|
T |
removeHeader(Header header)
Remove the specified header from this builder.
|
T |
removeHeader(String header)
Remove the specified header from this builder.
|
void |
reset() |
T |
upgrade(String upgrade)
Set the HTTP upgrade type.
|
protected Protocol protocol
protected String protocolString
protected Boolean chunked
protected Long contentLength
protected String contentType
protected String upgrade
protected MimeHeaders mimeHeaders
public final T protocol(Protocol protocol)
protocol
- Protocol
public final T protocol(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(String contentType)
HttpPacket
.contentType
- the content-type of this HttpPacket
.public final T upgrade(String upgrade)
upgrade
- the type of upgrade.public final T header(String name, String value)
name
- the mime header name.value
- the mime header value.public final T removeHeader(String header)
header
- the mime header.public final T header(Header header, 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 © 2014 Oracle Corporation. All rights reserved.