Package org.glassfish.grizzly.http
Class HttpHeader.Builder<T extends HttpHeader.Builder>
- java.lang.Object
-
- org.glassfish.grizzly.http.HttpHeader.Builder<T>
-
- Direct Known Subclasses:
HttpRequestPacket.Builder,HttpResponsePacket.Builder
- Enclosing class:
- HttpHeader
public abstract static class HttpHeader.Builder<T extends HttpHeader.Builder> extends Object
HttpHeader message builder.
-
-
Field Summary
Fields Modifier and Type Field Description protected Booleanchunkedprotected LongcontentLengthprotected StringcontentTypeprotected MimeHeadersmimeHeadersprotected Protocolprotocolprotected StringprotocolStringprotected Stringupgrade
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description HttpHeaderbuild()Tchunked(boolean chunked)Set true, if thisHttpPacketcontent will be transferred in chunking mode, or false if case of fixed-length message.TcontentLength(long contentLength)Set the content-length of thisHttpPacket.TcontentType(String contentType)Set the content-type of thisHttpPacket.protected abstract HttpHeadercreate()Theader(String name, String value)Add the HTTP mime header.Theader(Header header, String value)Add the HTTP mime header.TmaxNumHeaders(int maxHeaders)Sets the maximum number of headers allowed.Tprotocol(String protocolString)Set the HTTP message protocol version.Tprotocol(Protocol protocol)Set the HTTP message protocol version.TremoveHeader(String name)Remove the specified name from this builder.TremoveHeader(Header header)Remove the specified header from this builder.voidreset()Tupgrade(String upgrade)Set the HTTP upgrade type.
-
-
-
Method Detail
-
protocol
public final T protocol(Protocol protocol)
Set the HTTP message protocol version.- Parameters:
protocol-Protocol
-
protocol
public final T protocol(String protocolString)
Set the HTTP message protocol version.- Parameters:
protocolString- protocol version in format "HTTP/1.x".
-
chunked
public final T chunked(boolean chunked)
Set true, if thisHttpPacketcontent will be transferred in chunking mode, or false if case of fixed-length message.- Parameters:
chunked- true, if thisHttpPacketcontent will be transferred in chunking mode, or false if case of fixed-length message.
-
contentLength
public final T contentLength(long contentLength)
Set the content-length of thisHttpPacket. Applicable only in case of fixed-length HTTP message.- Parameters:
contentLength- the content-length of thisHttpPacket. Applicable only in case of fixed-length HTTP message.
-
contentType
public final T contentType(String contentType)
Set the content-type of thisHttpPacket.- Parameters:
contentType- the content-type of thisHttpPacket.
-
upgrade
public final T upgrade(String upgrade)
Set the HTTP upgrade type.- Parameters:
upgrade- the type of upgrade.
-
header
public final T header(String name, String value)
Add the HTTP mime header.- Parameters:
name- the mime header name.value- the mime header value.
-
removeHeader
public final T removeHeader(String name)
Remove the specified name from this builder. This method is only useful if using the same builder to create multiple objects.- Parameters:
name- the mime header name.- Returns:
- this
-
header
public final T header(Header header, String value)
Add the HTTP mime header.- Parameters:
header- the mimeHeader.value- the mime header value.
-
removeHeader
public final T removeHeader(Header header)
Remove the specified header from this builder. This method is only useful if using the same builder to create multiple objects.- Parameters:
header- the mimeHeader.- Returns:
- this
-
maxNumHeaders
public final T maxNumHeaders(int maxHeaders)
Sets the maximum number of headers allowed.
-
build
public HttpHeader build()
-
reset
public void reset()
-
create
protected abstract HttpHeader create()
-
-