Package org.apache.hc.core5.http.digest
Class DigestFields
- java.lang.Object
-
- org.apache.hc.core5.http.digest.DigestFields
-
public final class DigestFields extends java.lang.ObjectSupport for Digest Fields as defined by RFC 9530.Digest fields are Structured Field Dictionaries. Syntax parsing and serialization is therefore delegated to the RFC 9651 implementation in
StructuredFieldHeaders. This class only applies the additional semantic constraints imposed by RFC 9530.- Since:
- 5.5
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HeaderformatDigest(java.lang.String name, StructuredFieldDictionary value)Formats a validatedContent-DigestorRepr-Digestdictionary.static HeaderformatPreferences(java.lang.String name, StructuredFieldDictionary value)Formats a validatedWant-Content-DigestorWant-Repr-Digestdictionary.static StructuredFieldDictionaryparseDigest(Header header)Parses and validates aContent-DigestorRepr-Digestfield value.static StructuredFieldDictionaryparseDigest(MessageHeaders headers, java.lang.String name)Parses and validates all field lines with the given name as oneContent-DigestorRepr-Digestdictionary.static StructuredFieldDictionaryparsePreferences(Header header)Parses and validates aWant-Content-DigestorWant-Repr-Digestfield value.static StructuredFieldDictionaryparsePreferences(MessageHeaders headers, java.lang.String name)Parses and validates all field lines with the given name as oneWant-Content-DigestorWant-Repr-Digestdictionary.
-
-
-
Method Detail
-
parseDigest
public static StructuredFieldDictionary parseDigest(Header header) throws ParseException
Parses and validates aContent-DigestorRepr-Digestfield value.- Parameters:
header- the header to parse.- Returns:
- the parsed digest dictionary.
- Throws:
ParseException- if the field is syntactically invalid or any dictionary member is not a Byte Sequence item.
-
parseDigest
public static StructuredFieldDictionary parseDigest(MessageHeaders headers, java.lang.String name) throws ParseException
Parses and validates all field lines with the given name as oneContent-DigestorRepr-Digestdictionary.- Parameters:
headers- the message headers.name- the field name.- Returns:
- the parsed digest dictionary, or an empty dictionary if the field is not present.
- Throws:
ParseException- if the field is syntactically invalid or any dictionary member is not a Byte Sequence item.
-
parsePreferences
public static StructuredFieldDictionary parsePreferences(Header header) throws ParseException
Parses and validates aWant-Content-DigestorWant-Repr-Digestfield value.- Parameters:
header- the header to parse.- Returns:
- the parsed preference dictionary.
- Throws:
ParseException- if the field is syntactically invalid, a member is not an Integer item, or its value is outside the range 0..10.
-
parsePreferences
public static StructuredFieldDictionary parsePreferences(MessageHeaders headers, java.lang.String name) throws ParseException
Parses and validates all field lines with the given name as oneWant-Content-DigestorWant-Repr-Digestdictionary.- Parameters:
headers- the message headers.name- the field name.- Returns:
- the parsed preference dictionary, or an empty dictionary if the field is not present.
- Throws:
ParseException- if the field is syntactically invalid, a member is not an Integer item, or its value is outside the range 0..10.
-
formatDigest
public static Header formatDigest(java.lang.String name, StructuredFieldDictionary value)
Formats a validatedContent-DigestorRepr-Digestdictionary.- Parameters:
name- the field name.value- the digest dictionary.- Returns:
- the formatted header, or
nullfor an empty dictionary. - Throws:
java.lang.IllegalArgumentException- if any dictionary member is not a Byte Sequence item.
-
formatPreferences
public static Header formatPreferences(java.lang.String name, StructuredFieldDictionary value)
Formats a validatedWant-Content-DigestorWant-Repr-Digestdictionary.- Parameters:
name- the field name.value- the preference dictionary.- Returns:
- the formatted header, or
nullfor an empty dictionary. - Throws:
java.lang.IllegalArgumentException- if a member is not an Integer item or its value is outside the range 0..10.
-
-