Class StructuredFieldHeaders


  • public final class StructuredFieldHeaders
    extends java.lang.Object
    Integration between Structured Field values and HttpComponents message headers.
    Since:
    5.5
    • 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 named name as 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 null for an empty List or Dictionary.