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 TypeMethodDescriptionAdds the given header name-value pair.Adds each of the given header name-value pairs.headers(HttpHeaders headers) Adds all the given headers.removeHeader(String name) Removes all the header values associated with the given name.Removes all the headers added so far.removeHeadersIf(BiPredicate<String, String> filter) Removes all the header name-value pairs matched by the given predicate.Sets the header represented by the given name to the given value, overwriting the previous value (if any).Sets the header represented by the given name to the given values, overwriting the previous value (if any).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.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.
-
Method Details
-
header
Adds the given header name-value pair.- Throws:
IllegalArgumentException- if the given header is invalid
-
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
Adds all the given headers. -
setHeader
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
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
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
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
Removes all the headers added so far. -
removeHeader
-
removeHeadersIf
Removes all the header name-value pairs matched by the given predicate.
-