Package org.apache.gravitino.rest
Class RESTUtils
java.lang.Object
org.apache.gravitino.rest.RESTUtils
Referred from Apache Iceberg's RESTUtil implementation
core/src/main/java/org/apache/iceberg/rest/RESTUtil.java
Utility class for working with REST related operations.
-
Method Summary
Modifier and TypeMethodDescriptiondecodeFormData
(String formString) Decode a URL encoded form data string into a map.static String
decodeString
(String encoded) Decode a URL encoded string.static String
encodeFormData
(Map<?, ?> formData) Encode a map of form data into a URL encoded string.static String
encodeString
(String toEncode) URL encode a string.static int
findAvailablePort
(int portRangeStart, int portRangeEnd) Find an available port in the port range.static String
stripTrailingSlash
(String path) Remove trailing slashes from a path.
-
Method Details
-
stripTrailingSlash
Remove trailing slashes from a path.- Parameters:
path
- The path to strip trailing slashes from.- Returns:
- The path with trailing slashes removed.
-
encodeFormData
Encode a map of form data into a URL encoded string.- Parameters:
formData
- The form data to encode.- Returns:
- The URL encoded form data string.
-
decodeFormData
Decode a URL encoded form data string into a map.- Parameters:
formString
- The URL encoded form data string.- Returns:
- The decoded form data map.
-
encodeString
URL encode a string.- Parameters:
toEncode
- The string to encode.- Returns:
- The URL encoded string.
- Throws:
IllegalArgumentException
- If the input string is null.UncheckedIOException
- If URL encoding fails.
-
decodeString
Decode a URL encoded string.- Parameters:
encoded
- The URL encoded string to decode.- Returns:
- The decoded string.
- Throws:
IllegalArgumentException
- if the input string is null.UncheckedIOException
- if URL decoding fails.
-
findAvailablePort
Find an available port in the port range.- Parameters:
portRangeStart
- the start of the port rangeportRangeEnd
- the end of the port range- Returns:
- the available port
- Throws:
IOException
- if no available port in the port range
-