Loading pom.xml +5 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,11 @@ <artifactId>jackson-jaxrs-json-provider</artifactId> <version>2.12.2</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jsr310</artifactId> <version>2.12.2</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> Loading src/main/java/com/inteligr8/rs/Client.java +11 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,10 @@ package com.inteligr8.rs; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; /** * A class that provides pre-configured JAX-RS Client & WebTarget objects. Loading @@ -26,8 +29,15 @@ public abstract class Client { * @return A pre-configured JAX-RS client (no URL) with the specified authorization. */ public javax.ws.rs.client.Client getClient(AuthorizationFilter authFilter) { JacksonJsonProvider provider = new JacksonJaxbJsonProvider(); if (this.getConfig().isWrapRootValueEnabled()) provider.enable(SerializationFeature.WRAP_ROOT_VALUE); if (this.getConfig().isUnwrapRootValueEnabled()) provider.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); ClientBuilder clientBuilder = ClientBuilder.newBuilder() .register(new JacksonJaxbJsonProvider()); .register(provider); if (authFilter == null) authFilter = this.getConfig().createAuthorizationFilter(); Loading src/main/java/com/inteligr8/rs/ClientConfiguration.java +18 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,24 @@ public interface ClientConfiguration { return null; } /** * @return true to enable Jackson UNWRAP_ROOT_VALUE feature; false otherwise. */ default boolean isUnwrapRootValueEnabled() { return false; } /** * @return true to enable Jackson WRAP_ROOT_VALUE feature; false otherwise. */ default boolean isWrapRootValueEnabled() { return false; } /** * This method creates an authorization filter based on the configuration * available. A configuration element is considered to not be available Loading Loading
pom.xml +5 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,11 @@ <artifactId>jackson-jaxrs-json-provider</artifactId> <version>2.12.2</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jsr310</artifactId> <version>2.12.2</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> Loading
src/main/java/com/inteligr8/rs/Client.java +11 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,10 @@ package com.inteligr8.rs; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; /** * A class that provides pre-configured JAX-RS Client & WebTarget objects. Loading @@ -26,8 +29,15 @@ public abstract class Client { * @return A pre-configured JAX-RS client (no URL) with the specified authorization. */ public javax.ws.rs.client.Client getClient(AuthorizationFilter authFilter) { JacksonJsonProvider provider = new JacksonJaxbJsonProvider(); if (this.getConfig().isWrapRootValueEnabled()) provider.enable(SerializationFeature.WRAP_ROOT_VALUE); if (this.getConfig().isUnwrapRootValueEnabled()) provider.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); ClientBuilder clientBuilder = ClientBuilder.newBuilder() .register(new JacksonJaxbJsonProvider()); .register(provider); if (authFilter == null) authFilter = this.getConfig().createAuthorizationFilter(); Loading
src/main/java/com/inteligr8/rs/ClientConfiguration.java +18 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,24 @@ public interface ClientConfiguration { return null; } /** * @return true to enable Jackson UNWRAP_ROOT_VALUE feature; false otherwise. */ default boolean isUnwrapRootValueEnabled() { return false; } /** * @return true to enable Jackson WRAP_ROOT_VALUE feature; false otherwise. */ default boolean isWrapRootValueEnabled() { return false; } /** * This method creates an authorization filter based on the configuration * available. A configuration element is considered to not be available Loading