Package software.amazon.awssdk.http
Interface SdkHttpHeaders
-
- All Known Subinterfaces:
SdkHttpFullRequest,SdkHttpFullRequest.Builder,SdkHttpFullResponse,SdkHttpFullResponse.Builder,SdkHttpRequest,SdkHttpRequest.Builder,SdkHttpResponse,SdkHttpResponse.Builder
@Immutable public interface SdkHttpHeaders
An immutable set of HTTP headers.SdkHttpRequestshould be used for requests, andSdkHttpResponseshould be used for responses.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleananyMatchingHeader(Predicate<String> predicate)Returns whether any header key matches the provided predicate.default Optional<String>firstMatchingHeader(String header)Perform a case-insensitive search for a particular header in this request, returning the first matching header, if one is found.default Optional<String>firstMatchingHeader(Collection<String> headersToFind)default voidforEachHeader(BiConsumer<? super String,? super List<String>> consumer)Map<String,List<String>>headers()Returns a map of all HTTP headers in this message, sorted in case-insensitive order by their header name.default List<String>matchingHeaders(String header)default intnumHeaders()
-
-
-
Method Detail
-
headers
Map<String,List<String>> headers()
Returns a map of all HTTP headers in this message, sorted in case-insensitive order by their header name.This will never be null. If there are no headers an empty map is returned.
- Returns:
- An unmodifiable map of all headers in this message.
-
firstMatchingHeader
default Optional<String> firstMatchingHeader(String header)
Perform a case-insensitive search for a particular header in this request, returning the first matching header, if one is found.This is useful for headers like 'Content-Type' or 'Content-Length' of which there is expected to be only one value present.
This is equivalent to invoking
.SdkHttpUtils.firstMatchingHeader(Map, String)- Parameters:
header- The header to search for (case insensitively).- Returns:
- The first header that matched the requested one, or empty if one was not found.
-
anyMatchingHeader
default boolean anyMatchingHeader(Predicate<String> predicate)
Returns whether any header key matches the provided predicate.- Parameters:
predicate- the predicate to apply to all header keys- Returns:
- true if any header key matches the provided predicate, otherwise
false
-
firstMatchingHeader
default Optional<String> firstMatchingHeader(Collection<String> headersToFind)
-
forEachHeader
default void forEachHeader(BiConsumer<? super String,? super List<String>> consumer)
-
numHeaders
default int numHeaders()
-
-