Class TrailerHeader


  • public class TrailerHeader
    extends Header
    A Header representation of the Trailer HTTP response header. This header will contain a list of header names that the user-agent will have to expect as trailing headers, added after the response's body. This is informative only, and the actually listed trailer headers may not be present in the end, or additional trailing headers could appear compared to the originally listed ones.

    This class is not thread-safe.

    See Also:
    RFC2616 Section 14.40, RFC7230 Section 4.4, Mozilla Developper: Trailer
    • Constructor Detail

      • TrailerHeader

        public TrailerHeader()
    • Method Detail

      • getName

        public String getName()
        Description copied from class: Header
        Returns the name of the header, as it would canonically appear within an HTTP message.
        Specified by:
        getName in class Header
        Returns:
        The name of the header, as it would canonically appear within an HTTP message.
      • getValues

        public List<String> getValues()
        Description copied from class: Header
        Returns the header as a list of strings. If the header has no values then it must return an empty list, never null. Each String should represent the value component of the key-value pair that makes up the HTTP header - as such, for some Header implementations each String in this List may contain multiple token-separated values.

        The List returned from this method should not be expected to be mutable. However, some subclasses of Header may choose to implement it as such.

        Specified by:
        getValues in class Header
        Returns:
        The header as a non-null list of string values. Can be an empty list.
      • addTrailers

        public TrailerHeader addTrailers​(String... trailerNames)
        Add some new trailers that are expected to be received.
        Parameters:
        trailerNames - the names of the trailers
        Returns:
        the header itself to be able to chain method calls.
      • addTrailers

        public TrailerHeader addTrailers​(List<String> trailerNames)
        Add some new trailers that are expected to be received.
        Parameters:
        trailerNames - the names of the trailers
        Returns:
        the header itself to be able to chain method calls.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Header