Class SignatureField

All Implemented Interfaces:
Serializable, Cloneable, Map<String,byte[]>, SequencedMap<String,byte[]>

public class SignatureField extends LinkedHashMap<String,byte[]>
The Signature HTTP Field.
See Also:
  • Constructor Details

    • SignatureField

      public SignatureField()
      The default constructor.
    • SignatureField

      public SignatureField(Map<String,byte[]> members)
      A constructor with dictionary members, each of which represents a pair of label and signature.
      Parameters:
      members - Dictionary members in the value of the Signature HTTP field.
  • Method Details

    • parse

      public static SignatureField parse(String fieldValue) throws SignatureException
      Parse the value of the Signature HTTP field.
      Parameters:
      fieldValue - The value of the Signature HTTP field. If null is passed, this method returns null.
      Returns:
      The parsed field value.
      Throws:
      SignatureException - The passed field value could not be parsed successfully.
    • toString

      public String toString()
      Get the string representation of this instance, which is the serialized dictionary returned by the serialize() method.
      Overrides:
      toString in class AbstractMap<String,T>
      Returns:
      The string representation of this instance.
    • serialize

      public String serialize()
      Serialize the dictionary represented by this instance, as defined in RFC 8941 Structured Field Values for HTTP, and return the resulting string.
      Returns:
      The serialized dictionary represented by this instance.
    • serializeTo

      public StringBuilder serializeTo(StringBuilder sb)
      Serialize the dictionary represented by this instance, as defined in RFC 8941 Structured Field Values for HTTP, and write the resulting string into the specified string builder.

      The ABNF for Dictionaries from RFC 8941 Structured Field Values for HTTP, 3.2. Dictionaries:

       sf-dictionary  = dict-member *( OWS "," OWS dict-member )
       dict-member    = member-key ( parameters / ( "=" member-value ))
       member-key     = key
       member-value   = sf-item / inner-list
       
      Parameters:
      sb - A string builder into which the resulting string is written.
      Returns:
      The same string builder that was passed as the argument.