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 Details

    • protocol

      protected Protocol protocol
    • protocolString

      protected String protocolString
    • chunked

      protected Boolean chunked
    • contentLength

      protected Long contentLength
    • contentType

      protected String contentType
    • upgrade

      protected String upgrade
    • mimeHeaders

      protected MimeHeaders mimeHeaders
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • 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 this HttpPacket content will be transferred in chunking mode, or false if case of fixed-length message.
      Parameters:
      chunked - true, if this HttpPacket content 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 this HttpPacket. Applicable only in case of fixed-length HTTP message.
      Parameters:
      contentLength - the content-length of this HttpPacket. Applicable only in case of fixed-length HTTP message.
    • contentType

      public final T contentType(String contentType)
      Set the content-type of this HttpPacket.
      Parameters:
      contentType - the content-type of this HttpPacket.
    • 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 mime Header.
      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 mime Header.
      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()