Package com.oracle.bmc.http.internal
Class HeaderUtils
- java.lang.Object
-
- com.oracle.bmc.http.internal.HeaderUtils
-
public class HeaderUtils extends Object
Utilities to deal with header values.
-
-
Field Summary
Fields Modifier and Type Field Description static StringAUTHORIZATION_HEADER_NAMESee {@link HTTP/1.1 documentation}.static StringMEDIA_TYPE_APPLICATION_JSONA String constant representing “application/json”" media type.static StringREDACTED_VALUE
-
Constructor Summary
Constructors Constructor Description HeaderUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisSensitiveHeader(String headerName)Checks whether the given header name should be treated as sensitive.static Map<String,List<String>>sanitizeHeaders(Map<String,List<String>> headers)Redacts sensitive header values in the given header map.static List<String>sanitizeHeaderValues(String headerName, List<String> values)Redacts header values when the header name is sensitive.static <T> TtoValue(String headerName, String value, Class<T> clazz)Deserialize a header value to its desired type if possible.
-
-
-
Field Detail
-
REDACTED_VALUE
public static final String REDACTED_VALUE
- See Also:
- Constant Field Values
-
AUTHORIZATION_HEADER_NAME
public static final String AUTHORIZATION_HEADER_NAME
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
MEDIA_TYPE_APPLICATION_JSON
public static final String MEDIA_TYPE_APPLICATION_JSON
A String constant representing “application/json”" media type.- See Also:
- Constant Field Values
-
-
Method Detail
-
toValue
public static <T> T toValue(String headerName, String value, Class<T> clazz)
Deserialize a header value to its desired type if possible.- Parameters:
headerName- The header name.value- The header value.clazz- The class to convert to.- Returns:
- A new class instance.
-
isSensitiveHeader
public static boolean isSensitiveHeader(String headerName)
Checks whether the given header name should be treated as sensitive.- Parameters:
headerName- The header name.- Returns:
- true if the header is sensitive, false otherwise.
-
sanitizeHeaderValues
public static List<String> sanitizeHeaderValues(String headerName, List<String> values)
Redacts header values when the header name is sensitive.- Parameters:
headerName- The header name.values- The header values.- Returns:
- The redacted values if the header is sensitive, otherwise the original values.
-
-