Class RESTUtil
-
Field Summary
Modifier and TypeFieldDescriptionstatic final org.apache.iceberg.relocated.com.google.common.base.Joiner
static final org.apache.iceberg.relocated.com.google.common.base.Splitter
-
Method Summary
Modifier and TypeMethodDescriptiondecodeFormData
(String formString) Decodes a map of form data from application/x-www-form-urlencoded.static Namespace
decodeNamespace
(String encodedNs) Takes in a string representation of a namespace as used for a URL parameter and returns the corresponding namespace.static String
decodeString
(String encoded) Decodes a URL-encoded string.static String
encodeFormData
(Map<?, ?> formData) Encodes a map of form data as application/x-www-form-urlencoded.static String
Returns a String representation of a namespace that is suitable for use in a URL / URI.static String
encodeString
(String toEncode) Encodes a string using URL encodingextractPrefixMap
(Map<String, String> properties, String prefix) Takes in a map, and returns a copy filtered on the entries with keys beginning with the designated prefix.Merge updates into a target string map.static String
stripTrailingSlash
(String path)
-
Field Details
-
NAMESPACE_JOINER
public static final org.apache.iceberg.relocated.com.google.common.base.Joiner NAMESPACE_JOINER -
NAMESPACE_SPLITTER
public static final org.apache.iceberg.relocated.com.google.common.base.Splitter NAMESPACE_SPLITTER
-
-
Method Details
-
stripTrailingSlash
-
merge
Merge updates into a target string map.- Parameters:
target
- a map to updateupdates
- a map of updates- Returns:
- an immutable result map built from target and updates
-
extractPrefixMap
Takes in a map, and returns a copy filtered on the entries with keys beginning with the designated prefix. The keys are returned with the prefix removed.Any entries whose keys don't begin with the prefix are not returned.
This can be used to get a subset of the configuration related to the REST catalog, such as all properties from a prefix of `spark.sql.catalog.my_catalog.rest.` to get REST catalog specific properties from the spark configuration.
-
encodeFormData
Encodes a map of form data as application/x-www-form-urlencoded.This encodes the form with pairs separated by & and keys separated from values by =.
- Parameters:
formData
- a map of form data- Returns:
- a String of encoded form data
-
decodeFormData
Decodes a map of form data from application/x-www-form-urlencoded.This decodes the form with pairs separated by & and keys separated from values by =.
- Parameters:
formString
- a map of form data- Returns:
- a map of key/value form data
-
encodeString
Encodes a string using URL encodingdecodeString(String)
should be used to decode.- Parameters:
toEncode
- string to encode- Returns:
- UTF-8 encoded string, suitable for use as a URL parameter
-
decodeString
Decodes a URL-encoded string.See also
encodeString(String)
for URL encoding.- Parameters:
encoded
- a string to decode- Returns:
- a decoded string
-
encodeNamespace
Returns a String representation of a namespace that is suitable for use in a URL / URI.This function needs to be called when a namespace is used as a path variable (or query parameter etc.), to format the namespace per the spec.
decodeNamespace(java.lang.String)
should be used to parse the namespace from a URL parameter.- Parameters:
ns
- namespace to encode- Returns:
- UTF-8 encoded string representing the namespace, suitable for use as a URL parameter
-
decodeNamespace
Takes in a string representation of a namespace as used for a URL parameter and returns the corresponding namespace.See also
encodeNamespace(org.apache.iceberg.catalog.Namespace)
for generating correctly formatted URLs.- Parameters:
encodedNs
- a namespace to decode- Returns:
- a namespace
-