Interface HeaderCodec<A extends Header>

Type Parameters:
A - the header type encoded/decoded by the codec
All Known Implementing Classes:
AbstractHeaderCodec

public interface HeaderCodec<A extends Header>

A HTTP header codec is used to encode and decode HTTP headers.

Since:
1.0
Author:
Jeremy Kuhn
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte
    Colon ':'
    static final byte
    Comma ','
    static final byte
    Carriage return
    static final byte
    Double quote '"'
    static final byte
    Equals '='
    static final byte
    Horizontal tab
    static final byte
    Line feed character
    static final byte
    Semicolon ';'
    static final byte
    Horizontal space
    static final char
    Horizontal space
  • Method Summary

    Modifier and Type
    Method
    Description
    decode(String name, ByteBuf buffer, Charset charset)
    Decodes the specified raw value ByteBuf for the specified header name using the specified charset.
    decode(String name, String value)
    Decodes the specified raw header value for the specified header name.
    encode(A header)
    Encodes the specified header as a string.
    default void
    encode(A header, ByteBuf buffer, Charset charset)
    Encodes the specified header in the specified ByteBuffer using the specified charset.
    encodeValue(A header)
    Encodes the value of the specified header as a string.
    default void
    encodeValue(A header, ByteBuf buffer, Charset charset)
    Encodes the value of the specified header in the specified ByteBuffer using the specified charset.
    Returns a list of header names supported by the codec.
  • Field Details

  • Method Details

    • decode

      A decode(String name, String value)

      Decodes the specified raw header value for the specified header name.

      Parameters:
      name - a header name
      value - a header raw value
      Returns:
      a decoded header instance
    • decode

      A decode(String name, ByteBuf buffer, Charset charset)

      Decodes the specified raw value ByteBuf for the specified header name using the specified charset.

      Parameters:
      name - a header name
      buffer - a header raw value
      charset - the charset to use for decoding
      Returns:
      a decoded header instance
    • encode

      String encode(A header)

      Encodes the specified header as a string.

      The resulting value is a header field as defined by RFC 7230 Section 3.2.

      Parameters:
      header - the header to encode
      Returns:
      the encoded header
    • encode

      default void encode(A header, ByteBuf buffer, Charset charset)

      Encodes the specified header in the specified ByteBuffer using the specified charset.

      The resulting value is a header field as defined by RFC 7230 Section 3.2.

      Parameters:
      header - the header to encode
      buffer - the destination byte buffer
      charset - the charset to use for encoding
    • encodeValue

      String encodeValue(A header)

      Encodes the value of the specified header as a string.

      The resulting value corresponds to the header field value as defined by RFC 7230 Section 3.2.

      Parameters:
      header - the header to encode
      Returns:
      the encoded header value
    • encodeValue

      default void encodeValue(A header, ByteBuf buffer, Charset charset)

      Encodes the value of the specified header in the specified ByteBuffer using the specified charset.

      The resulting value corresponds to the header field value as defined by RFC 7230 Section 3.2.

      Parameters:
      header - the header to encode
      buffer - the destination byte buffer
      charset - the charset to use for encoding
    • getSupportedHeaderNames

      Set<String> getSupportedHeaderNames()

      Returns a list of header names supported by the codec.

      Returns:
      a list of header names