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
FieldsModifier and TypeFieldDescriptionstatic final byteColon ':'static final byteComma ','static final byteCarriage returnstatic final byteDouble quote '"'static final byteEquals '='static final byteHorizontal tabstatic final byteLine feed characterstatic final byteSemicolon ';'static final byteHorizontal spacestatic final charHorizontal space -
Method Summary
Modifier and TypeMethodDescriptionDecodes the specified raw valueByteBuffor 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 voidEncodes the specified header in the specifiedByteBufferusing the specified charset.encodeValue(A header) Encodes the value of the specified header as a string.default voidencodeValue(A header, ByteBuf buffer, Charset charset) Encodes the value of the specified header in the specifiedByteBufferusing 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
ByteBuffor 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
ByteBufferusing 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
ByteBufferusing 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 set of header names
-