Class StructuredFieldHeaders
- java.lang.Object
-
- org.apache.hc.core5.http.structured.StructuredFieldHeaders
-
public final class StructuredFieldHeaders extends java.lang.ObjectIntegration between Structured Field values and HttpComponents message headers.- Since:
- 5.5
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Headerformat(java.lang.String name, StructuredFieldValue value)Creates a header for a Structured Field value.static StructuredFieldDictionaryparseDictionary(Header header)Parses one header as an Structured Field Dictionary.static StructuredFieldDictionaryparseDictionary(MessageHeaders headers, java.lang.String name)Parses the matching field lines as a Structured Field Dictionary, reading each field line in place and merging its members, without combining the values into a new buffer.static StructuredFieldItemparseItem(Header header)Parses one header as an Structured Field Item.static StructuredFieldItemparseItem(MessageHeaders headers, java.lang.String name)Parses the field namednameas a single Structured Field Item.static StructuredFieldListparseList(Header header)Parses one header as an Structured Field List.static StructuredFieldListparseList(MessageHeaders headers, java.lang.String name)Parses the matching field lines as a Structured Field List, reading each field line in place and appending its members, without combining the values into a new buffer.
-
-
-
Method Detail
-
parseItem
public static StructuredFieldItem parseItem(Header header) throws ParseException
Parses one header as an Structured Field Item.- Parameters:
header- the header.- Returns:
- the parsed Item.
- Throws:
ParseException- if the complete field value is invalid.
-
parseItem
public static StructuredFieldItem parseItem(MessageHeaders headers, java.lang.String name) throws ParseException
Parses the field namednameas a single Structured Field Item. An Item is a single value and cannot span field lines, so more than one matching field line is rejected.- Parameters:
headers- the message headers.name- the case-insensitive field name.- Returns:
- the parsed Item.
- Throws:
ParseException- if the field is absent, spans multiple field lines, or is invalid.
-
parseList
public static StructuredFieldList parseList(Header header) throws ParseException
Parses one header as an Structured Field List.- Parameters:
header- the header.- Returns:
- the parsed List.
- Throws:
ParseException- if the complete field value is invalid.
-
parseList
public static StructuredFieldList parseList(MessageHeaders headers, java.lang.String name) throws ParseException
Parses the matching field lines as a Structured Field List, reading each field line in place and appending its members, without combining the values into a new buffer.- Parameters:
headers- the message headers.name- the case-insensitive field name.- Returns:
- the parsed List, empty when the field is absent.
- Throws:
ParseException- if any field line is invalid.
-
parseDictionary
public static StructuredFieldDictionary parseDictionary(Header header) throws ParseException
Parses one header as an Structured Field Dictionary.- Parameters:
header- the header.- Returns:
- the parsed Dictionary.
- Throws:
ParseException- if the complete field value is invalid.
-
parseDictionary
public static StructuredFieldDictionary parseDictionary(MessageHeaders headers, java.lang.String name) throws ParseException
Parses the matching field lines as a Structured Field Dictionary, reading each field line in place and merging its members, without combining the values into a new buffer. A repeated key keeps its last value.- Parameters:
headers- the message headers.name- the case-insensitive field name.- Returns:
- the parsed Dictionary, empty when the field is absent.
- Throws:
ParseException- if any field line is invalid.
-
format
public static Header format(java.lang.String name, StructuredFieldValue value)
Creates a header for a Structured Field value.- Parameters:
name- the field name.value- the Structured Field value.- Returns:
- a header, or
nullfor an empty List or Dictionary.
-
-