Class SdkHttpUtils
java.lang.Object
software.amazon.awssdk.utils.http.SdkHttpUtils
A set of utilities that assist with HTTP message-related interactions.
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.allMatchingHeadersFromCollection
(Map<String, List<String>> headersToSearch, Collection<String> headersToFind) Deprecated.UseSdkHttpHeaders#matchingHeaders
static String
Append the given path to the given baseUri, separating them with a slash, if required.encodeAndFlattenFormData
(Map<String, List<String>> rawFormData) Encode the provided form data usingencodeFormData(Map)
and then flatten them into a string that can be used as the body of a form data request.encodeAndFlattenQueryParameters
(Map<String, List<String>> rawQueryParameters) Encode the provided query parameters usingencodeQueryParameters(Map)
and then flatten them into a string that can be used as the query string in a URL.encodeFormData
(Map<String, List<String>> rawFormData) Encode each of the keys and values in the provided form data usingformDataEncode(String)
.encodeQueryParameters
(Map<String, List<String>> rawQueryParameters) Encode each of the keys and values in the provided query parameters usingurlEncode(String)
.Deprecated.UseSdkHttpHeaders#firstMatchingHeader
firstMatchingHeaderFromCollection
(Map<String, List<String>> headersToSearch, Collection<String> headersToFind) Deprecated.UseSdkHttpHeaders#firstMatchingHeader
static void
flattenQueryParameters
(StringBuilder result, Map<String, List<String>> toFlatten) Flatten the provided query parameters into a string that can be used as the query string in a URL.flattenQueryParameters
(Map<String, List<String>> toFlatten) Flatten the provided query parameters into a string that can be used as the query string in a URL.static String
formDataEncode
(String value) Encode a string according to RFC 1630: encoding for form data.static boolean
static boolean
isUsingStandardPort
(String protocol, Integer port) Returns true if the specified port is the standard port for the given protocol.Returns the Java system property for nonProxyHosts as set of Strings.splitQueryString
(String queryString) static int
standardPort
(String protocol) Retrieve the standard port for the provided protocol.Extracts query parameters from the given URIstatic String
Decode the string according to RFC 3986: encoding for URI paths, query strings, etc.static String
Encode a string according to RFC 3986: encoding for URI paths, query strings, etc.static String
urlEncodeIgnoreSlashes
(String value) Encode a string according to RFC 3986, but ignore "/" characters.
-
Method Details
-
urlEncode
-
urlEncodeIgnoreSlashes
-
formDataEncode
-
urlDecode
-
encodeQueryParameters
-
encodeFormData
-
encodeAndFlattenQueryParameters
-
encodeAndFlattenFormData
-
flattenQueryParameters
Flatten the provided query parameters into a string that can be used as the query string in a URL. The result is not prepended with "?". This is useful when you have already-encoded query parameters you wish to flatten. -
flattenQueryParameters
Flatten the provided query parameters into a string that can be used as the query string in a URL. The result is not prepended with "?". This is useful when you have already-encoded query parameters you wish to flatten. -
isUsingStandardPort
Returns true if the specified port is the standard port for the given protocol. (i.e. 80 for HTTP or 443 for HTTPS). Null or -1 ports (to simplify interaction withURI
's default value) are treated as standard ports.- Returns:
- True if the specified port is standard for the specified protocol, otherwise false.
-
standardPort
Retrieve the standard port for the provided protocol. -
appendUri
-
allMatchingHeaders
@Deprecated public static Stream<String> allMatchingHeaders(Map<String, List<String>> headers, String header) Deprecated.UseSdkHttpHeaders#matchingHeaders
Perform a case-insensitive search for a particular header in the provided map of headers.- Parameters:
headers
- The headers to search.header
- The header to search for (case insensitively).- Returns:
- A stream providing the values for the headers that matched the requested header.
-
allMatchingHeadersFromCollection
@Deprecated public static Stream<String> allMatchingHeadersFromCollection(Map<String, List<String>> headersToSearch, Collection<String> headersToFind) Deprecated.UseSdkHttpHeaders#matchingHeaders
Perform a case-insensitive search for a particular header in the provided map of headers.- Parameters:
headersToSearch
- The headers to search.headersToFind
- The headers to search for (case insensitively).- Returns:
- A stream providing the values for the headers that matched the requested header.
-
firstMatchingHeader
@Deprecated public static Optional<String> firstMatchingHeader(Map<String, List<String>> headers, String header) Deprecated.UseSdkHttpHeaders#firstMatchingHeader
Perform a case-insensitive search for a particular header in the provided map of headers, 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.- Parameters:
headers
- The headers to search.header
- The header to search for (case insensitively).- Returns:
- The first header that matched the requested one, or empty if one was not found.
-
firstMatchingHeaderFromCollection
@Deprecated public static Optional<String> firstMatchingHeaderFromCollection(Map<String, List<String>> headersToSearch, Collection<String> headersToFind) Deprecated.UseSdkHttpHeaders#firstMatchingHeader
Perform a case-insensitive search for a set of headers in the provided map of headers, returning the first matching header, if one is found.- Parameters:
headersToSearch
- The headers to search.headersToFind
- The header to search for (case insensitively).- Returns:
- The first header that matched a requested one, or empty if one was not found.
-
isSingleHeader
-
uriParams
-
splitQueryString
-
parseNonProxyHostsProperty
-
parseNonProxyHostsEnvironmentVariable
-
SdkHttpHeaders#matchingHeaders