Interface ResponseHeadersBuilder

    • Method Detail

      • add

        ResponseHeadersBuilder add​(CharSequence name,
                                   String... values)
        Description copied from interface: HttpHeadersBuilder
        Adds new headers with the specified name and values. This method is semantically equivalent to
        
         for (String value : values) {
             headers.add(name, value);
         }
         
        Specified by:
        add in interface HttpHeadersBuilder
        Parameters:
        name - the header name
        values - the header values
        Returns:
        this
      • set

        ResponseHeadersBuilder set​(CharSequence name,
                                   String... values)
        Description copied from interface: HttpHeadersBuilder
        Sets a header with the specified name and values. Any existing headers with the specified name are removed. This method is equivalent to:
        
         headers.remove(name);
         for (String v : values) {
             headers.add(name, v);
         }
         
        Specified by:
        set in interface HttpHeadersBuilder
        Parameters:
        name - the header name
        values - the header values
        Returns:
        this
      • isEndOfStream

        boolean isEndOfStream()
        Tells whether the headers correspond to the last frame in an HTTP/2 stream.
      • contentType

        @Nullable
        MediaType contentType()
        Returns the parsed "content-type" header.
        Returns:
        the parsed MediaType if present and valid. null otherwise.
      • get

        @Nullable
        String get​(CharSequence name)
        Returns the value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
        Parameters:
        name - the name of the header to retrieve
        Returns:
        the first header value if the header is found. null if there's no such header
      • get

        String get​(CharSequence name,
                   String defaultValue)
        Returns the value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
        Parameters:
        name - the name of the header to retrieve
        defaultValue - the default value
        Returns:
        the first header value or defaultValue if there is no such header
      • getAll

        List<String> getAll​(CharSequence name)
        Returns all values for the header with the specified name. The returned List can't be modified.
        Parameters:
        name - the name of the header to retrieve
        Returns:
        a List of header values or an empty List if there is no such header.
      • getInt

        @Nullable
        Integer getInt​(CharSequence name)
        Returns the int value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
        Parameters:
        name - the name of the header to retrieve
        Returns:
        the int value of the first value in insertion order or null if there is no such header or it can't be converted to int.
      • getInt

        int getInt​(CharSequence name,
                   int defaultValue)
        Returns the int value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
        Parameters:
        name - the name of the header to retrieve
        defaultValue - the default value
        Returns:
        the int value of the first value in insertion order or defaultValue if there is no such header or it can't be converted to int.
      • getLong

        @Nullable
        Long getLong​(CharSequence name)
        Returns the long value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
        Parameters:
        name - the name of the header to retrieve
        Returns:
        the long value of the first value in insertion order or null if there is no such header or it can't be converted to long.
      • getLong

        long getLong​(CharSequence name,
                     long defaultValue)
        Returns the long value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
        Parameters:
        name - the name of the header to retrieve
        defaultValue - the default value
        Returns:
        the long value of the first value in insertion order or defaultValue if there is no such header or it can't be converted to long.
      • getFloat

        @Nullable
        Float getFloat​(CharSequence name)
        Returns the float value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
        Parameters:
        name - the name of the header to retrieve
        Returns:
        the float value of the first value in insertion order or null if there is no such header or it can't be converted to float.
      • getFloat

        float getFloat​(CharSequence name,
                       float defaultValue)
        Returns the float value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
        Parameters:
        name - the name of the header to retrieve
        defaultValue - the default value
        Returns:
        the float value of the first value in insertion order or defaultValue if there is no such header or it can't be converted to float.
      • getDouble

        @Nullable
        Double getDouble​(CharSequence name)
        Returns the double value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
        Parameters:
        name - the name of the header to retrieve
        Returns:
        the double value of the first value in insertion order or null if there is no such header or it can't be converted to double.
      • getDouble

        double getDouble​(CharSequence name,
                         double defaultValue)
        Returns the double value of a header with the specified name. If there are more than one value for the specified name, the first value in insertion order is returned.
        Parameters:
        name - the name of the header to retrieve
        defaultValue - the default value
        Returns:
        the double value of the first value in insertion order or defaultValue if there is no such header or it can't be converted to double.
      • getTimeMillis

        @Nullable
        Long getTimeMillis​(CharSequence name)
        Returns the value of a header with the specified name in milliseconds. If there are more than one value for the specified name, the first value in insertion order is returned.
        Parameters:
        name - the name of the header to retrieve
        Returns:
        the milliseconds value of the first value in insertion order or null if there is no such header or it can't be converted to milliseconds.
      • getTimeMillis

        long getTimeMillis​(CharSequence name,
                           long defaultValue)
        Returns the value of a header with the specified name in milliseconds. If there are more than one value for the specified name, the first value in insertion order is returned.
        Parameters:
        name - the name of the header to retrieve
        defaultValue - the default value
        Returns:
        the milliseconds value of the first value in insertion order or defaultValue if there is no such header or it can't be converted to milliseconds.
      • contains

        boolean contains​(CharSequence name)
        Returns true if a header with the name exists, false otherwise.
        Parameters:
        name - the header name
      • contains

        boolean contains​(CharSequence name,
                         String value)
        Returns true if a header with the name and value exists.
        Parameters:
        name - the header name
        value - the header value of the header to find
      • containsObject

        boolean containsObject​(CharSequence name,
                               Object value)
        Returns true if a header with the name and value exists.
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if the header exists. false otherwise
      • containsInt

        boolean containsInt​(CharSequence name,
                            int value)
        Returns true if a header with the name and value exists.
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if the header exists. false otherwise
      • containsLong

        boolean containsLong​(CharSequence name,
                             long value)
        Returns true if a header with the name and value exists.
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if the header exists. false otherwise
      • containsFloat

        boolean containsFloat​(CharSequence name,
                              float value)
        Returns true if a header with the name and value exists.
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if the header exists. false otherwise
      • containsDouble

        boolean containsDouble​(CharSequence name,
                               double value)
        Returns true if a header with the name and value exists.
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if the header exists. false otherwise
      • containsTimeMillis

        boolean containsTimeMillis​(CharSequence name,
                                   long value)
        Returns true if a header with the name and value exists.
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if the header exists. false otherwise
      • size

        int size()
        Returns the number of headers.
      • isEmpty

        boolean isEmpty()
        Returns true if this headers does not contain any entries.
      • names

        Set<AsciiString> names()
        Returns a Set of all header names. The returned Set cannot be modified.
      • forEachValue

        void forEachValue​(CharSequence name,
                          Consumer<String> action)
        Invokes the specified action for all values of the headers with the specified name.
      • valueStream

        default Stream<String> valueStream​(CharSequence name)
        Returns a Stream that yields all values of the headers with the specified name.