public class RESTUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static org.apache.iceberg.relocated.com.google.common.base.Joiner |
NAMESPACE_JOINER |
static org.apache.iceberg.relocated.com.google.common.base.Splitter |
NAMESPACE_SPLITTER |
Modifier and Type | Method and Description |
---|---|
static java.util.Map<java.lang.String,java.lang.String> |
decodeFormData(java.lang.String formString)
Decodes a map of form data from application/x-www-form-urlencoded.
|
static Namespace |
decodeNamespace(java.lang.String encodedNs)
Takes in a string representation of a namespace as used for a URL parameter and returns the
corresponding namespace.
|
static java.lang.String |
decodeString(java.lang.String encoded)
Decodes a URL-encoded string.
|
static java.lang.String |
encodeFormData(java.util.Map<?,?> formData)
Encodes a map of form data as application/x-www-form-urlencoded.
|
static java.lang.String |
encodeNamespace(Namespace ns)
Returns a String representation of a namespace that is suitable for use in a URL / URI.
|
static java.lang.String |
encodeString(java.lang.String toEncode)
Encodes a string using URL encoding
|
static java.util.Map<java.lang.String,java.lang.String> |
extractPrefixMap(java.util.Map<java.lang.String,java.lang.String> properties,
java.lang.String prefix)
Takes in a map, and returns a copy filtered on the entries with keys beginning with the
designated prefix.
|
static java.util.Map<java.lang.String,java.lang.String> |
merge(java.util.Map<java.lang.String,java.lang.String> target,
java.util.Map<java.lang.String,java.lang.String> updates)
Merge updates into a target string map.
|
static java.lang.String |
stripTrailingSlash(java.lang.String path) |
public static final org.apache.iceberg.relocated.com.google.common.base.Joiner NAMESPACE_JOINER
public static final org.apache.iceberg.relocated.com.google.common.base.Splitter NAMESPACE_SPLITTER
public static java.lang.String stripTrailingSlash(java.lang.String path)
public static java.util.Map<java.lang.String,java.lang.String> merge(java.util.Map<java.lang.String,java.lang.String> target, java.util.Map<java.lang.String,java.lang.String> updates)
target
- a map to updateupdates
- a map of updatespublic static java.util.Map<java.lang.String,java.lang.String> extractPrefixMap(java.util.Map<java.lang.String,java.lang.String> properties, java.lang.String prefix)
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.
public static java.lang.String encodeFormData(java.util.Map<?,?> formData)
This encodes the form with pairs separated by & and keys separated from values by =.
formData
- a map of form datapublic static java.util.Map<java.lang.String,java.lang.String> decodeFormData(java.lang.String formString)
This decodes the form with pairs separated by & and keys separated from values by =.
formString
- a map of form datapublic static java.lang.String encodeString(java.lang.String toEncode)
decodeString(String)
should be used to decode.
toEncode
- string to encodepublic static java.lang.String decodeString(java.lang.String encoded)
See also encodeString(String)
for URL encoding.
encoded
- a string to decodepublic static java.lang.String encodeNamespace(Namespace ns)
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.
ns
- namespace to encodepublic static Namespace decodeNamespace(java.lang.String encodedNs)
See also encodeNamespace(org.apache.iceberg.catalog.Namespace)
for generating correctly formatted URLs.
encodedNs
- a namespace to decode