Interface VaultClient.RequestHeadersSpec<S extends VaultClient.RequestHeadersSpec<S>>
- Type Parameters:
S- a self reference to the spec type
- All Known Subinterfaces:
VaultClient.RequestBodySpec, VaultClient.RequestHeadersBodyPathSpec, VaultClient.RequestHeadersPathSpec<S>
- Enclosing interface:
VaultClient
public static interface VaultClient.RequestHeadersSpec<S extends VaultClient.RequestHeadersSpec<S>>
Contract for specifying request headers leading up to the exchange.
- Since:
- 4.1
- Author:
- Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionAdd the given, single header value under the given name.headers(Consumer<HttpHeaders> headersConsumer) Provides access to every header declared so far with the possibility to add, replace, or remove values.headers(HttpHeaders httpHeaders) Add or replace the given headers.default SSet the namespace for this request.retrieve()Enter the retrieve workflow and use the returnedVaultClient.ResponseSpecto select from a number of built-in options to extract the response.default Stoken(VaultToken token) Set the authentication token for this request.
-
Method Details
-
namespace
-
token
Set the authentication token for this request.- Parameters:
token- the Vault token.- Returns:
- this builder.
-
header
-
headers
Add or replace the given headers.- Parameters:
httpHeaders- the headers to be applied.- Returns:
- this builder.
-
headers
Provides access to every header declared so far with the possibility to add, replace, or remove values.- Parameters:
headersConsumer- the consumer to provide access to.- Returns:
- this builder.
-
retrieve
Enter the retrieve workflow and use the returnedVaultClient.ResponseSpecto select from a number of built-in options to extract the response. For example:ResponseEntity<Person> entity = client.get() .path("/persons/1") .retrieve() .toEntity(Person.class);Or if interested only in the body:
Person person = client.get() .path("/persons/1") .retrieve() .body(Person.class);Note that this method does not actually execute the request until you call one of the returnedVaultClient.ResponseSpec.By default, 4xx and 5xx response codes result in a
VaultClientResponseExceptionwith aHttpClientErrorExceptioncause respectiveHttpServerErrorExceptioncause. To customize error handling, useonStatushandlers.- Returns:
ResponseSpecto specify how to decode the body.
-