Module io.inverno.mod.http.base
Class GenericHeaderCodec<A extends Header,B extends HeaderBuilder<A,B>>
java.lang.Object
io.inverno.mod.http.base.header.AbstractHeaderCodec<A,B>
io.inverno.mod.http.base.internal.header.GenericHeaderCodec<A,B>
- Type Parameters:
A- the header type encoded/decoded by the codecB- the header builder type
- All Implemented Interfaces:
HeaderCodec<A>
public class GenericHeaderCodec<A extends Header,B extends HeaderBuilder<A,B>>
extends AbstractHeaderCodec<A,B>
Genric HTTP HeaderCodec implementation.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Field Summary
Fields inherited from class io.inverno.mod.http.base.header.AbstractHeaderCodec
builderSupplier, supportedHeaderNames -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGenericHeaderCodec(Supplier<B> builderSupplier, Set<String> supportedHeaderNames) Creates a generic HTTP header codec. -
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.encodeValue(A headerField) Encodes the value of the specified header as a string.Methods inherited from class io.inverno.mod.http.base.header.AbstractHeaderCodec
getSupportedHeaderNamesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.inverno.mod.http.base.header.HeaderCodec
encode, encodeValue
-
Constructor Details
-
GenericHeaderCodec
Creates a generic HTTP header codec.
- Parameters:
builderSupplier- a supplier to create header builder instances when decoding a headersupportedHeaderNames- the list of header names supported by the codec
-
-
Method Details
-
decode
Description copied from interface:HeaderCodecDecodes 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
Description copied from interface:HeaderCodecDecodes 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
Description copied from interface:HeaderCodecEncodes the specified header as a string.
The resulting value is a header field as defined by RFC 7230 Section 3.2.
- Parameters:
headerField- the header to encode- Returns:
- the encoded header
-
encodeValue
Description copied from interface:HeaderCodecEncodes 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:
headerField- the header to encode- Returns:
- the encoded header value
-