Package org.jgroups.protocols.kubernetes
Class Utils
java.lang.Object
org.jgroups.protocols.kubernetes.Utils
- Author:
- Ales Justin
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidclose(AutoCloseable cl) static final <V> Vstatic final <V> Vstatic final StringgetSystemEnv(String key) static final StringgetSystemEnv(String key, String def) static final StringgetSystemEnv(String key, String def, boolean trimToNull) static final StringgetSystemProperty(String key, String def) static final StringgetSystemProperty(String key, String def, boolean trimToNull) static final InputStreamstatic final InputStreamopenStream(String url, Map<String, String> headers, int connectTimeout, int readTimeout, int attempts, long sleep, StreamProvider streamProvider) static final StringreadFileToString(File file) static final StringreadFileToString(String name) sanitizeHttpHeaders(Map<String, String> headers) Sanitizes a map of HTTP headers - all entries where the key equals "Authorization" (case-insensitive) are overridden to mask the original authorization data.static final StringtrimToNull(String s) static final String
-
Method Details
-
openStream
public static final InputStream openStream(String url, Map<String, String> headers, int connectTimeout, int readTimeout, int attempts, long sleep, StreamProvider streamProvider) throws Exception- Throws:
Exception
-
openFile
- Throws:
FileNotFoundException
-
readFileToString
- Throws:
IOException
-
readFileToString
- Throws:
IOException
-
getSystemProperty
-
getSystemProperty
-
getSystemEnv
-
getSystemEnv
-
getSystemEnv
-
trimToNull
-
urlencode
-
execute
-
execute
public static final <V> V execute(Callable<V> callable, int attempts, long sleep, boolean throwOnFail) throws Exception - Throws:
Exception
-
close
-
sanitizeHttpHeaders
Sanitizes a map of HTTP headers - all entries where the key equals "Authorization" (case-insensitive) are overridden to mask the original authorization data.- Parameters:
headers- HTTP header map- Returns:
- map where all "Authorization" entries are masked
-