Search in sources :

Example 1 with NessieHttpResponseFilter

use of org.projectnessie.client.rest.NessieHttpResponseFilter 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);
}
Also used : NessieHttpResponseFilter(org.projectnessie.client.rest.NessieHttpResponseFilter) HttpClient(org.projectnessie.client.http.HttpClient) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) NessieApiV1(org.projectnessie.client.api.NessieApiV1)

Example 2 with NessieHttpResponseFilter

use of org.projectnessie.client.rest.NessieHttpResponseFilter in project nessie by projectnessie.

the class TestNessieError method setup.

@BeforeAll
static void setup() {
    ObjectMapper mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
    client = HttpClient.builder().setBaseUri(URI.create(baseURI)).setObjectMapper(mapper).addResponseFilter(new NessieHttpResponseFilter(mapper)).build();
}
Also used : NessieHttpResponseFilter(org.projectnessie.client.rest.NessieHttpResponseFilter) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with NessieHttpResponseFilter

use of org.projectnessie.client.rest.NessieHttpResponseFilter in project nessie by projectnessie.

the class NessieHttpClient method buildClient.

private static HttpClient buildClient(HttpAuthentication authentication, boolean enableTracing, Builder clientBuilder) {
    clientBuilder.setObjectMapper(MAPPER);
    if (enableTracing) {
        addTracing(clientBuilder);
    }
    if (authentication != null) {
        authentication.applyToHttpClient(clientBuilder);
    }
    clientBuilder.addResponseFilter(new NessieHttpResponseFilter(MAPPER));
    return clientBuilder.build();
}
Also used : NessieHttpResponseFilter(org.projectnessie.client.rest.NessieHttpResponseFilter)

Aggregations

NessieHttpResponseFilter (org.projectnessie.client.rest.NessieHttpResponseFilter)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 BeforeAll (org.junit.jupiter.api.BeforeAll)1 NessieApiV1 (org.projectnessie.client.api.NessieApiV1)1 HttpClient (org.projectnessie.client.http.HttpClient)1