use of org.projectnessie.client.http.HttpClient in project nessie by projectnessie.
the class AbstractRest method init.
protected void init(URI uri) {
NessieApiV1 api = HttpClientBuilder.builder().withUri(uri).build(NessieApiV1.class);
ObjectMapper mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
HttpClient.Builder httpClient = HttpClient.builder().setBaseUri(uri).setObjectMapper(mapper);
httpClient.addResponseFilter(new NessieHttpResponseFilter(mapper));
init(api, httpClient, uri);
}
use of org.projectnessie.client.http.HttpClient in project nessie by projectnessie.
the class TestJerseyRestNaiveClientInMemory method init.
@Override
protected void init(NessieApiV1 api, @Nullable HttpClient.Builder httpClient, URI uri) {
assumeThat(httpClient).isNotNull();
// Intentionally remove the `Accept` header from requests.
// Service endpoints should declare the content type for their return values,
// which should allow the Web Container to properly format output even in the absence
// of `Accept` HTTP headers.
RequestFilter noAcceptFilter = context -> context.removeHeader(HEADER_ACCEPT);
httpClient.addRequestFilter(noAcceptFilter);
api = HttpClientBuilder.builder().withAuthentication((HttpAuthentication) client -> client.addRequestFilter(noAcceptFilter)).withUri(httpClient.getBaseUri()).build(NessieApiV1.class);
super.init(api, httpClient, uri);
}
Aggregations