Interface HttpRequestHeaders
- All Known Implementing Classes:
HttpHeadersBuilder
public interface HttpRequestHeaders
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault HttpRequestHeadersSet the list of acceptable media types, as specified by theAcceptheader.default HttpRequestHeadersacceptCharset(Charset... acceptableCharsets) Set the list of acceptable charsets, as specified by theAccept-Charsetheader.Adds the given name value pair to the set of headers for this request.default HttpRequestHeaderscontentType(MediaType contentType) Sets the MediaType of the body, specified by theContent-Typeheader.voidforEach(BiConsumer<String, List<String>> callback) Performs the provided callback for each header.Get an immutable list of header values for the given header name, possibly empty.Returns an Optional of the first header value for the given header name, if any.Removes the header with the specified name, if present.Sets the given name value pair to the set of headers for this request.
-
Method Details
-
add
Adds the given name value pair to the set of headers for this request. The given value is added to the list of values for that name.- Parameters:
headerName- the header nameheaderValue- the header value- Returns:
- this instance
-
set
Sets the given name value pair to the set of headers for this request.- Parameters:
headerName- the header nameheaderValues- the header values- Returns:
- this instance
-
remove
Removes the header with the specified name, if present.- Parameters:
headerName- the header name- Returns:
- this instance
-
get
Get an immutable list of header values for the given header name, possibly empty.- Parameters:
headerName- the header name- Returns:
- the list of header values, or an empty list
-
getFirst
Returns an Optional of the first header value for the given header name, if any.- Parameters:
headerName- the header name- Returns:
- an
Optionalof first header value orOptional.empty()if none
-
contentType
- Returns:
- an
Optionalof the of theContent-Typeheader
-
contentType
Sets the MediaType of the body, specified by theContent-Typeheader. Can be null.- Returns:
- this instance
-
accept
Set the list of acceptable media types, as specified by theAcceptheader.- Parameters:
acceptableMediaTypes- the acceptable media types- Returns:
- this instance
-
acceptCharset
Set the list of acceptable charsets, as specified by theAccept-Charsetheader.- Parameters:
acceptableCharsets- the acceptable charsets- Returns:
- this builder
-
forEach
Performs the provided callback for each header.
-