Package org.forgerock.http.header
Class HeaderFactory<H extends Header>
java.lang.Object
org.forgerock.http.header.HeaderFactory<H>
- Type Parameters:
H- The type ofHeaderproduced by the factory.
- Direct Known Subclasses:
AuthorizationHeader.Factory
Creates instances of
Header classes from String representation.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Map<String,HeaderFactory<?>> A map of header names to knownHeaderFactoryimplementations.A map ofHeadertypes to the names of the headers they implement. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the associated header class.protected abstract StringGet the associated header name.Create a header instance from a provided object representation.protected abstract HCreate a header instance from String representation, which may contain multiple values if the header supports them.protected abstract HCreate a header instance from a list of String representations, each of which may in turn contain multiple values if the header supports them.
-
Field Details
-
HEADER_NAMES
A map ofHeadertypes to the names of the headers they implement. -
FACTORIES
A map of header names to knownHeaderFactoryimplementations.
-
-
Constructor Details
-
HeaderFactory
public HeaderFactory()
-
-
Method Details
-
parse
Create a header instance from String representation, which may contain multiple values if the header supports them.- Parameters:
value- The string representation.- Returns:
- The parsed header.
- Throws:
MalformedHeaderException- When the value cannot be parsed.
-
parse
Create a header instance from a list of String representations, each of which may in turn contain multiple values if the header supports them.- Parameters:
values- The string representations.- Returns:
- The parsed header.
- Throws:
MalformedHeaderException- When the value cannot be parsed.
-
parse
Create a header instance from a provided object representation.Subclasses may wish to override this method in order to support other types of value.
- Parameters:
value- An object representation - may be a string, a collection of strings, an array of strings, an instance ofHeader, or some other object type supported by the subclass.- Returns:
- The parsed header.
- Throws:
MalformedHeaderException- When the value cannot be parsed.
-
getHeaderClass
Get the associated header class.- Returns:
- the header class
-
getHeaderName
Get the associated header name.- Returns:
- the header name
-