public final class SdkHttpUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.util.stream.Stream<java.lang.String> |
allMatchingHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers,
java.lang.String header)
Perform a case-insensitive search for a particular header in the provided map
of headers.
|
static java.lang.String |
appendUri(java.lang.String baseUri,
java.lang.String path)
Append the given path to the given baseUri, separating them with a slash, if
required.
|
static java.util.Optional<java.lang.String> |
encodeAndFlattenFormData(java.util.Map<java.lang.String,java.util.List<java.lang.String>> rawFormData)
Encode the provided form data using
encodeFormData(Map) and then
flatten them into a string that can be used as the body of a form data
request. |
static java.util.Optional<java.lang.String> |
encodeAndFlattenQueryParameters(java.util.Map<java.lang.String,java.util.List<java.lang.String>> rawQueryParameters)
Encode the provided query parameters using
encodeQueryParameters(Map) and then flatten them into a string that
can be used as the query string in a URL. |
static java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
encodeFormData(java.util.Map<java.lang.String,java.util.List<java.lang.String>> rawFormData)
Encode each of the keys and values in the provided form data using
formDataEncode(String) . |
static java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
encodeQueryParameters(java.util.Map<java.lang.String,java.util.List<java.lang.String>> rawQueryParameters)
Encode each of the keys and values in the provided query parameters using
urlEncode(String) . |
static java.util.Optional<java.lang.String> |
firstMatchingHeader(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers,
java.lang.String header)
Perform a case-insensitive search for a particular header in the provided map
of headers, returning the first matching header, if one is found.
|
static java.util.Optional<java.lang.String> |
flattenQueryParameters(java.util.Map<java.lang.String,java.util.List<java.lang.String>> toFlatten)
Flatten the provided query parameters into a string that can be used as the
query string in a URL.
|
static java.lang.String |
formDataEncode(java.lang.String value)
Encode a string according to RFC 1630: encoding for form data.
|
static boolean |
isSingleHeader(java.lang.String h) |
static boolean |
isUsingStandardPort(java.lang.String protocol,
java.lang.Integer port)
Returns true if the specified port is the standard port for the given
protocol.
|
static int |
standardPort(java.lang.String protocol)
Retrieve the standard port for the provided protocol.
|
static java.lang.String |
urlDecode(java.lang.String value)
Decode the string according to RFC 3986: encoding for URI paths, query
strings, etc.
|
static java.lang.String |
urlEncode(java.lang.String value)
Encode a string according to RFC 3986: encoding for URI paths, query strings,
etc.
|
static java.lang.String |
urlEncodeIgnoreSlashes(java.lang.String value)
Encode a string according to RFC 3986, but ignore "/" characters.
|
public static java.lang.String urlEncode(java.lang.String value)
public static java.lang.String urlEncodeIgnoreSlashes(java.lang.String value)
public static java.lang.String formDataEncode(java.lang.String value)
public static java.lang.String urlDecode(java.lang.String value)
Assumes the decoded string is UTF-8 encoded.
value
- The string to decode.public static java.util.Map<java.lang.String,java.util.List<java.lang.String>> encodeQueryParameters(java.util.Map<java.lang.String,java.util.List<java.lang.String>> rawQueryParameters)
urlEncode(String)
.public static java.util.Map<java.lang.String,java.util.List<java.lang.String>> encodeFormData(java.util.Map<java.lang.String,java.util.List<java.lang.String>> rawFormData)
formDataEncode(String)
.public static java.util.Optional<java.lang.String> encodeAndFlattenQueryParameters(java.util.Map<java.lang.String,java.util.List<java.lang.String>> rawQueryParameters)
encodeQueryParameters(Map)
and then flatten them into a string that
can be used as the query string in a URL. The result is not prepended with
"?".public static java.util.Optional<java.lang.String> encodeAndFlattenFormData(java.util.Map<java.lang.String,java.util.List<java.lang.String>> rawFormData)
encodeFormData(Map)
and then
flatten them into a string that can be used as the body of a form data
request.public static java.util.Optional<java.lang.String> flattenQueryParameters(java.util.Map<java.lang.String,java.util.List<java.lang.String>> toFlatten)
public static boolean isUsingStandardPort(java.lang.String protocol, java.lang.Integer port)
URI
's default value)
are treated as standard ports.public static int standardPort(java.lang.String protocol)
public static java.lang.String appendUri(java.lang.String baseUri, java.lang.String path)
public static java.util.stream.Stream<java.lang.String> allMatchingHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, java.lang.String header)
headers
- The headers to search.header
- The header to search for (case insensitively).public static java.util.Optional<java.lang.String> firstMatchingHeader(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, java.lang.String header)
headers
- The headers to search.header
- The header to search for (case insensitively).public static boolean isSingleHeader(java.lang.String h)
Copyright © 2021. All Rights Reserved.