Interface HeaderCodec<A extends Header>
- Type Parameters:
A
- the header type encoded/decoded by the codec
- All Known Implementing Classes:
AbstractHeaderCodec
A HTTP header codec is used to encode and decode HTTP headers.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final byte
Colon ':'static final byte
Comma ','static final byte
Carriage returnstatic final byte
Double quote '"'static final byte
Equals '='static final byte
Horizontal tabstatic final byte
Line feed characterstatic final byte
Semicolon ';'static final byte
Horizontal spacestatic final char
Horizontal space -
Method Summary
Modifier and TypeMethodDescriptionDecodes the specified raw valueByteBuf
for the specified header name using the specified charset.Decodes the specified raw header value for the specified header name.Encodes the specified header as a string.default void
Encodes the specified header in the specifiedByteBuffer
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 specifiedByteBuffer
using the specified charset.Returns a list of header names supported by the codec.
-
Field Details
-
SP
static final byte SPHorizontal space- See Also:
-
HT
static final byte HTHorizontal tab- See Also:
-
CR
static final byte CRCarriage return- See Also:
-
EQUALS
static final byte EQUALSEquals '='- See Also:
-
LF
static final byte LFLine feed character- See Also:
-
COLON
static final byte COLONColon ':'- See Also:
-
SEMICOLON
static final byte SEMICOLONSemicolon ';'- See Also:
-
COMMA
static final byte COMMAComma ','- See Also:
-
DOUBLE_QUOTE
static final byte DOUBLE_QUOTEDouble quote '"'- See Also:
-
SP_CHAR
static final char SP_CHARHorizontal space- See Also:
-
-
Method Details
-
decode
Decodes the specified raw header value for the specified header name.
- Parameters:
name
- a header namevalue
- a header raw value- Returns:
- a decoded header instance
-
decode
Decodes the specified raw value
ByteBuf
for the specified header name using the specified charset.- Parameters:
name
- a header namebuffer
- a header raw valuecharset
- the charset to use for decoding- Returns:
- a decoded header instance
-
encode
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
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 encodebuffer
- the destination byte buffercharset
- the charset to use for encoding
-
encodeValue
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
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 encodebuffer
- the destination byte buffercharset
- the charset to use for encoding
-
getSupportedHeaderNames
Returns a list of header names supported by the codec.
- Returns:
- a list of header names
-