Package org.springframework.vault.client
Class VaultResponses
java.lang.Object
org.springframework.vault.client.VaultResponses
Utility methods to unwrap Vault responses and build
VaultException
.- Author:
- Mark Paluch
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic VaultException
buildException
(HttpStatusCode statusCode, String path, String message) static VaultException
Build aVaultException
givenHttpStatusCodeException
.static VaultException
buildException
(HttpStatusCodeException e, String path) static String
Obtain the error message from a JSON response.static <T> ParameterizedTypeReference<VaultResponseSupport<T>>
getTypeReference
(Class<T> responseType) Create aParameterizedTypeReference
forresponseType
.static <T> T
Unwrap a wrapped response created by Vault Response Wrapping
-
Constructor Details
-
VaultResponses
public VaultResponses()
-
-
Method Details
-
buildException
Build aVaultException
givenHttpStatusCodeException
.- Parameters:
e
- must not be null.- Returns:
- the
VaultException
.
-
buildException
- Parameters:
e
- must not be null.path
- must not be null.- Returns:
- the
VaultException
.
-
buildException
-
getTypeReference
public static <T> ParameterizedTypeReference<VaultResponseSupport<T>> getTypeReference(Class<T> responseType) Create aParameterizedTypeReference
forresponseType
.- Parameters:
responseType
- must not be null.- Returns:
- the
ParameterizedTypeReference
forresponseType
.
-
getError
Obtain the error message from a JSON response.- Parameters:
json
- must not be null.- Returns:
- extracted error string.
-
unwrap
Unwrap a wrapped response created by Vault Response Wrapping- Parameters:
wrappedResponse
- the wrapped response , must not be empty or null.responseType
- the type of the return value.- Returns:
- the unwrapped response.
-