Class StructuredFieldHeaders
java.lang.Object
org.apache.hc.core5.http.structured.StructuredFieldHeaders
Integration between Structured Field values and HttpComponents message headers.
- Since:
- 5.5
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Headerformat(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, 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 StructuredFieldItemParses one header as an Structured Field Item.static StructuredFieldItemparseItem(MessageHeaders headers, String name) Parses the field namednameas a single Structured Field Item.static StructuredFieldListParses one header as an Structured Field List.static StructuredFieldListparseList(MessageHeaders headers, 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.
-
Constructor Details
-
StructuredFieldHeaders
private StructuredFieldHeaders()
-
-
Method Details
-
parseItem
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, 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
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, 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
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, 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
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.
-