Commit 2c4f4f72 authored by Brian Long's avatar Brian Long
Browse files

added basic java.time support

parent 23c76c4b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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>
+11 −1
Original line number Diff line number Diff line
@@ -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 &amp; WebTarget objects.
@@ -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();
+18 −0
Original line number Diff line number Diff line
@@ -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