Module methanol
Package com.github.mizosoft.methanol
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Theader(java.lang.String name, java.lang.String value)Adds the given header name-value pair.Theaders(java.lang.String... headers)Adds each of the given header name-value pairs.Theaders(java.net.http.HttpHeaders headers)Adds all the given headers.TremoveHeader(java.lang.String name)Removes all the header values associated with the given name.TremoveHeaders()Removes all the headers added so far.TremoveHeadersIf(java.util.function.BiPredicate<java.lang.String,java.lang.String> filter)Removes all the header name-value pairs matched by the given predicate.TsetHeader(java.lang.String name, java.lang.String value)Sets the header represented by the given name to the given value, overwriting the previous value (if any).TsetHeader(java.lang.String name, java.util.List<java.lang.String> values)Sets the header represented by the given name to the given values, overwriting the previous value (if any).TsetHeaderIfAbsent(java.lang.String name, java.lang.String value)Sets the header represented by the given name to the given value, only if there was no header with the given name.TsetHeaderIfAbsent(java.lang.String name, java.util.List<java.lang.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 Detail
-
header
@CanIgnoreReturnValue T header(java.lang.String name, java.lang.String value)
Adds the given header name-value pair.- Throws:
java.lang.IllegalArgumentException- if the given header is invalid
-
headers
@CanIgnoreReturnValue T headers(java.lang.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:
java.lang.IllegalArgumentException- if any of the given headers is invalid, or the given array has an uneven or non-positive length
-
headers
@CanIgnoreReturnValue T headers(java.net.http.HttpHeaders headers)
Adds all the given headers.
-
setHeader
@CanIgnoreReturnValue T setHeader(java.lang.String name, java.lang.String value)
Sets the header represented by the given name to the given value, overwriting the previous value (if any).- Throws:
java.lang.IllegalArgumentException- if the given header is invalid
-
setHeader
@CanIgnoreReturnValue T setHeader(java.lang.String name, java.util.List<java.lang.String> values)
Sets the header represented by the given name to the given values, overwriting the previous value (if any).- Throws:
java.lang.IllegalArgumentException- if the given header is invalid
-
setHeaderIfAbsent
@CanIgnoreReturnValue T setHeaderIfAbsent(java.lang.String name, java.lang.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:
java.lang.IllegalArgumentException- if the given header is invalid
-
setHeaderIfAbsent
@CanIgnoreReturnValue T setHeaderIfAbsent(java.lang.String name, java.util.List<java.lang.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:
java.lang.IllegalArgumentException- if the given header is invalid
-
removeHeaders
@CanIgnoreReturnValue T removeHeaders()
Removes all the headers added so far.
-
removeHeader
@CanIgnoreReturnValue T removeHeader(java.lang.String name)
Removes all the header values associated with the given name.
-
removeHeadersIf
@CanIgnoreReturnValue T removeHeadersIf(java.util.function.BiPredicate<java.lang.String,java.lang.String> filter)
Removes all the header name-value pairs matched by the given predicate.
-
-