public final class SdkHttpUtils extends Object
Type | Property and Description |
---|---|
static Set<String> |
parseNonProxyHosts
Returns the Java system property for nonProxyHosts as set of Strings.
|
Modifier and Type | Method and Description |
---|---|
static Stream<String> |
allMatchingHeaders(Map<String,List<String>> headers,
String header)
Deprecated.
Use
SdkHttpHeaders#matchingHeaders |
static Stream<String> |
allMatchingHeadersFromCollection(Map<String,List<String>> headersToSearch,
Collection<String> headersToFind)
Deprecated.
Use
SdkHttpHeaders#matchingHeaders |
static String |
appendUri(String baseUri,
String path)
Append the given path to the given baseUri, separating them with a slash, if required.
|
static Optional<String> |
encodeAndFlattenFormData(Map<String,List<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 Optional<String> |
encodeAndFlattenQueryParameters(Map<String,List<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 Map<String,List<String>> |
encodeFormData(Map<String,List<String>> rawFormData)
Encode each of the keys and values in the provided form data using
formDataEncode(String) . |
static Map<String,List<String>> |
encodeQueryParameters(Map<String,List<String>> rawQueryParameters)
Encode each of the keys and values in the provided query parameters using
urlEncode(String) . |
static Optional<String> |
firstMatchingHeader(Map<String,List<String>> headers,
String header)
Deprecated.
Use
SdkHttpHeaders#firstMatchingHeader |
static Optional<String> |
firstMatchingHeaderFromCollection(Map<String,List<String>> headersToSearch,
Collection<String> headersToFind)
Deprecated.
Use
SdkHttpHeaders#firstMatchingHeader |
static Optional<String> |
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 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.
|
static String |
formDataEncode(String value)
Encode a string according to RFC 1630: encoding for form data.
|
static boolean |
isSingleHeader(String h) |
static boolean |
isUsingStandardPort(String protocol,
Integer port)
Returns true if the specified port is the standard port for the given protocol.
|
static Set<String> |
parseNonProxyHostsProperty()
Returns the Java system property for nonProxyHosts as set of Strings.
|
static List<String> |
splitQueryString(String queryString) |
static int |
standardPort(String protocol)
Retrieve the standard port for the provided protocol.
|
static Map<String,List<String>> |
uriParams(URI uri)
Extracts query parameters from the given URI
|
static String |
urlDecode(String value)
Decode the string according to RFC 3986: encoding for URI paths, query strings, etc.
|
static String |
urlEncode(String value)
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.
|
public static String urlEncode(String value)
public static String urlEncodeIgnoreSlashes(String value)
public static String formDataEncode(String value)
public static String urlDecode(String value)
Assumes the decoded string is UTF-8 encoded.
value
- The string to decode.public static Map<String,List<String>> encodeQueryParameters(Map<String,List<String>> rawQueryParameters)
urlEncode(String)
.public static Map<String,List<String>> encodeFormData(Map<String,List<String>> rawFormData)
formDataEncode(String)
.public static Optional<String> encodeAndFlattenQueryParameters(Map<String,List<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 Optional<String> encodeAndFlattenFormData(Map<String,List<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 Optional<String> flattenQueryParameters(Map<String,List<String>> toFlatten)
public static void flattenQueryParameters(StringBuilder result, Map<String,List<String>> toFlatten)
public static boolean isUsingStandardPort(String protocol, Integer port)
URI
's default value) are treated as standard ports.public static int standardPort(String protocol)
public static String appendUri(String baseUri, String path)
@Deprecated public static Stream<String> allMatchingHeaders(Map<String,List<String>> headers, String header)
SdkHttpHeaders#matchingHeaders
headers
- The headers to search.header
- The header to search for (case insensitively).@Deprecated public static Stream<String> allMatchingHeadersFromCollection(Map<String,List<String>> headersToSearch, Collection<String> headersToFind)
SdkHttpHeaders#matchingHeaders
headersToSearch
- The headers to search.headersToFind
- The headers to search for (case insensitively).@Deprecated public static Optional<String> firstMatchingHeader(Map<String,List<String>> headers, String header)
SdkHttpHeaders#firstMatchingHeader
headers
- The headers to search.header
- The header to search for (case insensitively).@Deprecated public static Optional<String> firstMatchingHeaderFromCollection(Map<String,List<String>> headersToSearch, Collection<String> headersToFind)
SdkHttpHeaders#firstMatchingHeader
headersToSearch
- The headers to search.headersToFind
- The header to search for (case insensitively).public static boolean isSingleHeader(String h)
public static Map<String,List<String>> uriParams(URI uri)
Copyright © 2023. All rights reserved.