Interface HeadersAccumulator<T extends HeadersAccumulator<T>>

All Known Implementing Classes:
MutableRequest, ResponseBuilder

public interface HeadersAccumulator<T extends HeadersAccumulator<T>>
An accumulator of header name-value pairs.
  • Method Summary

    Modifier and Type
    Method
    Description
    header(String name, String value)
    Adds the given header name-value pair.
    headers(String... headers)
    Adds each of the given header name-value pairs.
    Adds all the given headers.
    Removes all the header values associated with the given name.
    Removes all the headers added so far.
    Removes all the header name-value pairs matched by the given predicate.
    setHeader(String name, String value)
    Sets the header represented by the given name to the given value, overwriting the previous value (if any).
    setHeader(String name, List<String> values)
    Sets the header represented by the given name to the given values, overwriting the previous value (if any).
    Sets the header represented by the given name to the given value, only if there was no header with the given name.
    Sets the header represented by the given name to the given values, only if there was no header with the given name.
  • Method Details

    • header

      @CanIgnoreReturnValue T header(String name, String value)
      Adds the given header name-value pair.
      Throws:
      IllegalArgumentException - if the given header is invalid
    • headers

      @CanIgnoreReturnValue T headers(String... headers)
      Adds each of the given header name-value pairs. The pairs must be appended to each other in the given array, where each name is followed by a corresponding value.
      Throws:
      IllegalArgumentException - if any of the given headers is invalid, or the given array has an uneven or non-positive length
    • headers

      @CanIgnoreReturnValue T headers(HttpHeaders headers)
      Adds all the given headers.
    • setHeader

      @CanIgnoreReturnValue T setHeader(String name, String value)
      Sets the header represented by the given name to the given value, overwriting the previous value (if any).
      Throws:
      IllegalArgumentException - if the given header is invalid
    • setHeader

      @CanIgnoreReturnValue T setHeader(String name, List<String> values)
      Sets the header represented by the given name to the given values, overwriting the previous value (if any).
      Throws:
      IllegalArgumentException - if the given header is invalid
    • setHeaderIfAbsent

      @CanIgnoreReturnValue T setHeaderIfAbsent(String name, String value)
      Sets the header represented by the given name to the given value, only if there was no header with the given name.
      Throws:
      IllegalArgumentException - if the given header is invalid
    • setHeaderIfAbsent

      @CanIgnoreReturnValue T setHeaderIfAbsent(String name, List<String> values)
      Sets the header represented by the given name to the given values, only if there was no header with the given name.
      Throws:
      IllegalArgumentException - if the given header is invalid
    • removeHeaders

      @CanIgnoreReturnValue T removeHeaders()
      Removes all the headers added so far.
    • removeHeader

      @CanIgnoreReturnValue T removeHeader(String name)
      Removes all the header values associated with the given name.
    • removeHeadersIf

      @CanIgnoreReturnValue T removeHeadersIf(BiPredicate<String,String> filter)
      Removes all the header name-value pairs matched by the given predicate.