Merge branch 'develop' into stable
This commit is contained in:
commit
b1b19d8cb0
134
pom.xml
134
pom.xml
@ -3,8 +3,8 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.inteligr8</groupId>
|
||||
<artifactId>common-rest-api</artifactId>
|
||||
<version>1.1.6</version>
|
||||
<artifactId>common-rest-client</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>ReST API Client for Java</name>
|
||||
|
||||
<properties>
|
||||
@ -39,11 +39,6 @@
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>2.12.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-multipart</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
@ -54,36 +49,6 @@
|
||||
<artifactId>jakarta.ws.rs-api</artifactId>
|
||||
<version>2.1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.ext</groupId>
|
||||
<artifactId>jersey-proxy-client</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.core</groupId>
|
||||
<artifactId>jersey-client</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-rs-client</artifactId>
|
||||
<version>${cxf.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.inject</groupId>
|
||||
<artifactId>jersey-hk2</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-json-jackson</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
@ -106,6 +71,37 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-jaxrs-src</id>
|
||||
<goals><goal>add-source</goal></goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/main/${jaxrs.impl}</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add-test-src</id>
|
||||
<goals><goal>add-test-source</goal></goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/test/${jaxrs.impl}</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<classifier>${jaxrs.impl}</classifier>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
@ -144,6 +140,70 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jaxrs-jersey</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
<property>
|
||||
<name>jaxrs.impl</name>
|
||||
<value>jersey</value>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<jaxrs.impl>jersey</jaxrs.impl>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.ext</groupId>
|
||||
<artifactId>jersey-proxy-client</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.core</groupId>
|
||||
<artifactId>jersey-client</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-multipart</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.inject</groupId>
|
||||
<artifactId>jersey-hk2</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-json-jackson</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jaxrs-cxf</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>jaxrs.impl</name>
|
||||
<value>cxf</value>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<jaxrs.impl>cxf</jaxrs.impl>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-rs-client</artifactId>
|
||||
<version>${cxf.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>inteligr8-public</id>
|
||||
|
@ -3,6 +3,7 @@ package com.inteligr8.rs;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ws.rs.ext.RuntimeDelegate;
|
||||
|
||||
import org.apache.cxf.BusFactory;
|
||||
@ -11,7 +12,8 @@ import org.apache.cxf.jaxrs.client.WebClient;
|
||||
import org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
|
||||
|
||||
@ -21,22 +23,26 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
|
||||
*
|
||||
* @author brian@inteligr8.com
|
||||
*/
|
||||
public abstract class ClientCxfImpl extends Client implements InitializingBean {
|
||||
@Component("client.cxf")
|
||||
public class ClientCxfImpl extends Client {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ClientCxfImpl.class);
|
||||
|
||||
@Override
|
||||
protected abstract ClientCxfConfiguration getConfig();
|
||||
private ClientCxfConfiguration config;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
this.register();
|
||||
/**
|
||||
* This constructor is for Spring or POJO use
|
||||
*/
|
||||
@Autowired
|
||||
public ClientCxfImpl(ClientCxfConfiguration config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method registers the Apache CXF library as the default provider for
|
||||
* the JAX-RS specification.
|
||||
*/
|
||||
@PostConstruct
|
||||
public void register() {
|
||||
if (RuntimeDelegate.getInstance() == null) {
|
||||
this.logger.info("Setting JAX-RS runtime delegate to the CXF library");
|
||||
@ -95,6 +101,10 @@ public abstract class ClientCxfImpl extends Client implements InitializingBean {
|
||||
// for extension purposes
|
||||
}
|
||||
|
||||
public ClientCxfConfiguration getConfig() {
|
||||
return this.config;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method retrieves a JAX-RS implementation of the specified API with
|
||||
* the specified authorization.
|
@ -18,7 +18,7 @@ public abstract class Client {
|
||||
private final Object sync = new Object();
|
||||
private javax.ws.rs.client.Client client;
|
||||
|
||||
protected abstract ClientConfiguration getConfig();
|
||||
public abstract ClientConfiguration getConfig();
|
||||
|
||||
/**
|
||||
* @return A pre-configured JAX-RS client (no URL) with configured authorization.
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.inteligr8.rs;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ws.rs.client.ClientBuilder;
|
||||
import javax.ws.rs.ext.RuntimeDelegate;
|
||||
|
||||
@ -9,7 +10,8 @@ import org.glassfish.jersey.internal.RuntimeDelegateImpl;
|
||||
import org.glassfish.jersey.media.multipart.MultiPartFeature;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* A class that provides pre-configured JAX-RS Client & WebTarget objects
|
||||
@ -17,22 +19,26 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
*
|
||||
* @author brian@inteligr8.com
|
||||
*/
|
||||
public abstract class ClientJerseyImpl extends Client implements InitializingBean {
|
||||
@Component("client.jersey")
|
||||
public class ClientJerseyImpl extends Client {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ClientJerseyImpl.class);
|
||||
|
||||
@Override
|
||||
protected abstract ClientJerseyConfiguration getConfig();
|
||||
private ClientJerseyConfiguration config;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
this.register();
|
||||
/**
|
||||
* This constructor is for Spring or POJO use
|
||||
*/
|
||||
@Autowired
|
||||
public ClientJerseyImpl(ClientJerseyConfiguration config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method registers the Jersey library as the default provider for the
|
||||
* JAX-RS specification.
|
||||
*/
|
||||
@PostConstruct
|
||||
public void register() {
|
||||
if (RuntimeDelegate.getInstance() == null) {
|
||||
this.logger.info("Setting JAX-RS runtime delegate to the Jersey library");
|
||||
@ -58,6 +64,10 @@ public abstract class ClientJerseyImpl extends Client implements InitializingBea
|
||||
}
|
||||
}
|
||||
|
||||
public ClientJerseyConfiguration getConfig() {
|
||||
return this.config;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method retrieves a JAX-RS implementation of the specified API with
|
||||
* the specified authorization.
|
Loading…
x
Reference in New Issue
Block a user