The Java HTTP client implements AutoCloseable since JDK 21. Closing the
client ensures that asynchronous operations and streams are properly
terminated.
As we support Java 11, we add any old school "finally" wrapper and
conditionally close the client when running on a modern platform.
Timestamps have been stored with their String representation from the
API with convenience methods to convert them into ZonedDateTime.
We now use the Jackson JavaTimeModule to parse them directly and swap
the real and convenience getters.
Remove constructors of HTTPVaultConnector and make the builder
constructor package-private to enforce use of .builder()....build()
For convenience we add direct builder constructors with a full URI
argument to allow a one-line initialization if necessary.
Local variables with obvious type on both sides of their declaration
use type inference now for more concise code. Some variable names are
given a more precise name though.
The pattern is always the same, issue request, parse String response
into target class and catch exceptions. Bundle these blocks in the
helper class for GET, POST and PUT methods to reduce overhead in the
actual connector.