Compare commits
27 Commits
Author | SHA1 | Date | |
---|---|---|---|
5cda622082 | |||
e1191abaaa | |||
9dfd72c12e | |||
67ea4b72b3 | |||
a574154c20 | |||
5f4a56cd0e | |||
b1b19d8cb0 | |||
78ccdb5713 | |||
53d9c7381d | |||
3a003eff29 | |||
b2272e181c | |||
160766e0ef | |||
e167ac43cc | |||
e398099c15 | |||
a28fc13161 | |||
52c7e3cf6d | |||
b4d7d2a154 | |||
95730a9440 | |||
bd7413bb48 | |||
75c518801f | |||
556909f2e9 | |||
6fd42a8daf | |||
aea7a0d035 | |||
d3f10e4c00 | |||
b3bc04467b | |||
88c8657a34 | |||
2c4f4f7285 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,6 +2,9 @@
|
|||||||
target
|
target
|
||||||
pom.xml.versionsBackup
|
pom.xml.versionsBackup
|
||||||
|
|
||||||
|
# Maven Invoker
|
||||||
|
build.log
|
||||||
|
|
||||||
# Eclipse
|
# Eclipse
|
||||||
.project
|
.project
|
||||||
.classpath
|
.classpath
|
||||||
|
162
pom-release.xml
Normal file
162
pom-release.xml
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
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-client</artifactId>
|
||||||
|
<version>2.0.1</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<name>ReST API Client for Java</name>
|
||||||
|
<description>A common library for building REST API clients that support both the CXF and Jersey frameworks</description>
|
||||||
|
<url>https://bitbucket.org/inteligr8/common-rest-client</url>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007</name>
|
||||||
|
<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:https://bitbucket.org/inteligr8/common-rest-client.git</connection>
|
||||||
|
<developerConnection>scm:git:git@bitbucket.org:inteligr8/common-rest-client.git</developerConnection>
|
||||||
|
<url>https://bitbucket.org/inteligr8/common-rest-client</url>
|
||||||
|
</scm>
|
||||||
|
<organization>
|
||||||
|
<name>Inteligr8</name>
|
||||||
|
<url>https://www.inteligr8.com</url>
|
||||||
|
</organization>
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<id>brian.long</id>
|
||||||
|
<name>Brian Long</name>
|
||||||
|
<email>brian@inteligr8.com</email>
|
||||||
|
<url>https://twitter.com/brianmlong</url>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-invoker-plugin</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
<configuration>
|
||||||
|
<goals><goal>package</goal></goals>
|
||||||
|
<pom>pom.xml</pom>
|
||||||
|
<streamLogs>true</streamLogs>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>cxf</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals><goal>run</goal></goals>
|
||||||
|
<configuration>
|
||||||
|
<properties>
|
||||||
|
<jaxrs.impl>cxf</jaxrs.impl>
|
||||||
|
</properties>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>jersey</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals><goal>run</goal></goals>
|
||||||
|
<configuration>
|
||||||
|
<properties>
|
||||||
|
<jaxrs.impl>jersey</jaxrs.impl>
|
||||||
|
</properties>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>common</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals><goal>run</goal></goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-artifacts</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals><goal>attach-artifact</goal></goals>
|
||||||
|
<configuration>
|
||||||
|
<artifacts>
|
||||||
|
<artifact>
|
||||||
|
<file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>
|
||||||
|
<type>jar</type>
|
||||||
|
</artifact>
|
||||||
|
<artifact>
|
||||||
|
<file>${project.build.directory}/${project.artifactId}-${project.version}-javadoc.jar</file>
|
||||||
|
<classifier>javadoc</classifier>
|
||||||
|
<type>jar</type>
|
||||||
|
</artifact>
|
||||||
|
<artifact>
|
||||||
|
<file>${project.build.directory}/${project.artifactId}-${project.version}-sources.jar</file>
|
||||||
|
<classifier>sources</classifier>
|
||||||
|
<type>jar</type>
|
||||||
|
</artifact>
|
||||||
|
<artifact>
|
||||||
|
<file>${project.build.directory}/${project.artifactId}-${project.version}-cxf.jar</file>
|
||||||
|
<classifier>cxf</classifier>
|
||||||
|
<type>jar</type>
|
||||||
|
</artifact>
|
||||||
|
<artifact>
|
||||||
|
<file>${project.build.directory}/${project.artifactId}-${project.version}-jersey.jar</file>
|
||||||
|
<classifier>jersey</classifier>
|
||||||
|
<type>jar</type>
|
||||||
|
</artifact>
|
||||||
|
</artifacts>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-install-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<pomFile>pom.xml</pomFile>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>ossrh-release</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>sign</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals><goal>sign</goal></goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.sonatype.plugins</groupId>
|
||||||
|
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||||
|
<version>1.6.13</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<serverId>ossrh</serverId>
|
||||||
|
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
|
||||||
|
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
</project>
|
192
pom.xml
192
pom.xml
@@ -1,11 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>com.inteligr8</groupId>
|
<groupId>com.inteligr8</groupId>
|
||||||
<artifactId>common-rest-api</artifactId>
|
<artifactId>common-rest-client</artifactId>
|
||||||
<version>1.1.2</version>
|
<version>2.0.1</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>ReST API Client for Java</name>
|
<name>ReST API Client for Java</name>
|
||||||
|
<description>A common library for building REST API clients that support both the CXF and Jersey frameworks</description>
|
||||||
|
<url>https://bitbucket.org/inteligr8/common-rest-client</url>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007</name>
|
||||||
|
<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:https://bitbucket.org/inteligr8/common-rest-client.git</connection>
|
||||||
|
<developerConnection>scm:git:git@bitbucket.org:inteligr8/common-rest-client.git</developerConnection>
|
||||||
|
<url>https://bitbucket.org/inteligr8/common-rest-client</url>
|
||||||
|
</scm>
|
||||||
|
<organization>
|
||||||
|
<name>Inteligr8</name>
|
||||||
|
<url>https://www.inteligr8.com</url>
|
||||||
|
</organization>
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<id>brian.long</id>
|
||||||
|
<name>Brian Long</name>
|
||||||
|
<email>brian@inteligr8.com</email>
|
||||||
|
<url>https://twitter.com/brianmlong</url>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
|
||||||
@@ -14,7 +45,7 @@
|
|||||||
|
|
||||||
<junit.version>5.7.2</junit.version>
|
<junit.version>5.7.2</junit.version>
|
||||||
<spring.version>5.2.14.RELEASE</spring.version>
|
<spring.version>5.2.14.RELEASE</spring.version>
|
||||||
<jersey.version>2.34</jersey.version>
|
<jersey.version>2.35</jersey.version>
|
||||||
<cxf.version>3.3.2</cxf.version>
|
<cxf.version>3.3.2</cxf.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@@ -34,6 +65,11 @@
|
|||||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||||
<version>2.12.2</version>
|
<version>2.12.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
<version>2.12.2</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
@@ -44,36 +80,6 @@
|
|||||||
<artifactId>jakarta.ws.rs-api</artifactId>
|
<artifactId>jakarta.ws.rs-api</artifactId>
|
||||||
<version>2.1.6</version>
|
<version>2.1.6</version>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
@@ -96,6 +102,37 @@
|
|||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<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>
|
<plugin>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>3.0.0-M5</version>
|
<version>3.0.0-M5</version>
|
||||||
@@ -118,6 +155,16 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>source</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals><goal>jar-no-fork</goal></goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<executions>
|
<executions>
|
||||||
@@ -134,21 +181,66 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<pluginRepositories>
|
<profiles>
|
||||||
<pluginRepository>
|
<profile>
|
||||||
<id>inteligr8-public</id>
|
<id>jaxrs-jersey</id>
|
||||||
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
|
<activation>
|
||||||
</pluginRepository>
|
<property>
|
||||||
</pluginRepositories>
|
<name>jaxrs.impl</name>
|
||||||
|
<value>jersey</value>
|
||||||
<distributionManagement>
|
</property>
|
||||||
<repository>
|
</activation>
|
||||||
<id>inteligr8-releases</id>
|
<properties>
|
||||||
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
|
<jaxrs.impl>jersey</jaxrs.impl>
|
||||||
</repository>
|
</properties>
|
||||||
<snapshotRepository>
|
<dependencies>
|
||||||
<id>inteligr8-snapshots</id>
|
<dependency>
|
||||||
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-snapshots</url>
|
<groupId>org.glassfish.jersey.ext</groupId>
|
||||||
</snapshotRepository>
|
<artifactId>jersey-proxy-client</artifactId>
|
||||||
</distributionManagement>
|
<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>
|
||||||
</project>
|
</project>
|
||||||
|
38
src/main/cxf/com/inteligr8/rs/ClientCxfConfiguration.java
Normal file
38
src/main/cxf/com/inteligr8/rs/ClientCxfConfiguration.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface defines additional configurations specific to the Apache CXF
|
||||||
|
* JAX-RS library and its nuances.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
|
public interface ClientCxfConfiguration extends ClientConfiguration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apache CXF uses a global bus configuration where interceptors could
|
||||||
|
* wreck havoc on your implementation. This method allows you to
|
||||||
|
* explicitly by-pass the default bus.
|
||||||
|
*
|
||||||
|
* See https://cxf.apache.org/docs/bus-configuration.html.
|
||||||
|
*
|
||||||
|
* @return true to use the default bus; false otherwise.
|
||||||
|
*/
|
||||||
|
default boolean isDefaultBusEnabled() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,8 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.inteligr8.rs;
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.ws.rs.ext.RuntimeDelegate;
|
import javax.ws.rs.ext.RuntimeDelegate;
|
||||||
|
|
||||||
import org.apache.cxf.BusFactory;
|
import org.apache.cxf.BusFactory;
|
||||||
@@ -11,7 +26,8 @@ import org.apache.cxf.jaxrs.client.WebClient;
|
|||||||
import org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl;
|
import org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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;
|
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
|
||||||
|
|
||||||
@@ -21,22 +37,27 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
|
|||||||
*
|
*
|
||||||
* @author brian@inteligr8.com
|
* @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);
|
private final Logger logger = LoggerFactory.getLogger(ClientCxfImpl.class);
|
||||||
|
|
||||||
@Override
|
private ClientCxfConfiguration config;
|
||||||
protected abstract ClientCxfConfiguration getConfig();
|
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public void afterPropertiesSet() {
|
* This constructor is for Spring or POJO use.
|
||||||
this.register();
|
* @param config The client configuration.
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
public ClientCxfImpl(ClientCxfConfiguration config) {
|
||||||
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method registers the Apache CXF library as the default provider for
|
* This method registers the Apache CXF library as the default provider for
|
||||||
* the JAX-RS specification.
|
* the JAX-RS specification.
|
||||||
*/
|
*/
|
||||||
|
@PostConstruct
|
||||||
public void register() {
|
public void register() {
|
||||||
if (RuntimeDelegate.getInstance() == null) {
|
if (RuntimeDelegate.getInstance() == null) {
|
||||||
this.logger.info("Setting JAX-RS runtime delegate to the CXF library");
|
this.logger.info("Setting JAX-RS runtime delegate to the CXF library");
|
||||||
@@ -66,12 +87,16 @@ public abstract class ClientCxfImpl extends Client implements InitializingBean {
|
|||||||
public WebClient getCxfClient(AuthorizationFilter authFilter) {
|
public WebClient getCxfClient(AuthorizationFilter authFilter) {
|
||||||
List<Object> providersAndFilters = new LinkedList<Object>();
|
List<Object> providersAndFilters = new LinkedList<Object>();
|
||||||
providersAndFilters.add(new JacksonJaxbJsonProvider());
|
providersAndFilters.add(new JacksonJaxbJsonProvider());
|
||||||
|
providersAndFilters.add(new CxfLoggingFilter());
|
||||||
|
providersAndFilters.add(new CxfMultipartProvider());
|
||||||
|
|
||||||
if (authFilter == null)
|
if (authFilter == null)
|
||||||
authFilter = this.getConfig().createAuthorizationFilter();
|
authFilter = this.getConfig().createAuthorizationFilter();
|
||||||
if (authFilter != null)
|
if (authFilter != null)
|
||||||
providersAndFilters.add(authFilter);
|
providersAndFilters.add(authFilter);
|
||||||
|
|
||||||
|
this.addProvidersAndFilters(providersAndFilters);
|
||||||
|
|
||||||
// we can't use JAXRSClientFactory with a JAXRS client (duh!)
|
// we can't use JAXRSClientFactory with a JAXRS client (duh!)
|
||||||
// so we need to create a CXF client
|
// so we need to create a CXF client
|
||||||
WebClient client = WebClient.create(this.getConfig().getBaseUrl(), providersAndFilters);
|
WebClient client = WebClient.create(this.getConfig().getBaseUrl(), providersAndFilters);
|
||||||
@@ -87,6 +112,20 @@ public abstract class ClientCxfImpl extends Client implements InitializingBean {
|
|||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param providersAndFilters A list of JAX-RS and CXF providers.
|
||||||
|
*/
|
||||||
|
public void addProvidersAndFilters(List<Object> providersAndFilters) {
|
||||||
|
// for extension purposes
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The client configuration.
|
||||||
|
*/
|
||||||
|
public ClientCxfConfiguration getConfig() {
|
||||||
|
return this.config;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method retrieves a JAX-RS implementation of the specified API with
|
* This method retrieves a JAX-RS implementation of the specified API with
|
||||||
* the specified authorization.
|
* the specified authorization.
|
52
src/main/cxf/com/inteligr8/rs/CxfLoggingFilter.java
Normal file
52
src/main/cxf/com/inteligr8/rs/CxfLoggingFilter.java
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.ws.rs.client.ClientRequestContext;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a CXF specific handling of the logging of multipart requests, which
|
||||||
|
* would otherwise be ignored by the base LoggingFilter. It is meant to be
|
||||||
|
* used for debugging purposes. When used, it will write to 'jaxrs.request' and
|
||||||
|
* 'jaxrs.response' loggers at the 'trace' level.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
|
public class CxfLoggingFilter extends LoggingFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void logUnhandledRequest(ClientRequestContext requestContext, Logger logger) throws IOException {
|
||||||
|
if (MediaType.MULTIPART_FORM_DATA_TYPE.equals(requestContext.getMediaType())) {
|
||||||
|
if (requestContext.getEntity() instanceof MultipartBody) {
|
||||||
|
List<String> attIds = new LinkedList<>();
|
||||||
|
for (Attachment att : ((MultipartBody)requestContext.getEntity()).getAllAttachments())
|
||||||
|
attIds.add(att.getContentId());
|
||||||
|
logger.trace("request: {} {}: {}", requestContext.getMethod(), requestContext.getUri(), attIds);
|
||||||
|
} else {
|
||||||
|
logger.trace("request: {} {}: failed to output form", requestContext.getMethod(), requestContext.getUri());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
49
src/main/cxf/com/inteligr8/rs/CxfMultipartProvider.java
Normal file
49
src/main/cxf/com/inteligr8/rs/CxfMultipartProvider.java
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
|
import java.lang.annotation.Annotation;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.ext.Provider;
|
||||||
|
|
||||||
|
import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
|
||||||
|
import org.apache.cxf.jaxrs.provider.MultipartProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This implements a JAX-RS provider that adds support for the handling of CXF
|
||||||
|
* MultipartBody.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
|
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||||
|
@Produces(MediaType.MULTIPART_FORM_DATA)
|
||||||
|
@Provider
|
||||||
|
public class CxfMultipartProvider extends MultipartProvider {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
|
||||||
|
return MultipartBody.class.isAssignableFrom(type) || super.isReadable(type, genericType, annotations, mediaType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
|
||||||
|
return MultipartBody.class.isAssignableFrom(type) || super.isWriteable(type, genericType, annotations, mediaType);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.inteligr8.rs;
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
import javax.ws.rs.client.ClientRequestFilter;
|
import javax.ws.rs.client.ClientRequestFilter;
|
||||||
|
@@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.inteligr8.rs;
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
@@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.inteligr8.rs;
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
import javax.ws.rs.client.ClientRequestContext;
|
import javax.ws.rs.client.ClientRequestContext;
|
||||||
|
@@ -1,9 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.inteligr8.rs;
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
import javax.ws.rs.client.ClientBuilder;
|
import javax.ws.rs.client.ClientBuilder;
|
||||||
import javax.ws.rs.client.WebTarget;
|
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.JacksonJaxbJsonProvider;
|
||||||
|
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that provides pre-configured JAX-RS Client & WebTarget objects.
|
* A class that provides pre-configured JAX-RS Client & WebTarget objects.
|
||||||
@@ -12,13 +29,24 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
|
|||||||
*/
|
*/
|
||||||
public abstract class Client {
|
public abstract class Client {
|
||||||
|
|
||||||
protected abstract ClientConfiguration getConfig();
|
private final Object sync = new Object();
|
||||||
|
private javax.ws.rs.client.Client client;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The client configuration.
|
||||||
|
*/
|
||||||
|
public abstract ClientConfiguration getConfig();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return A pre-configured JAX-RS client (no URL) with configured authorization.
|
* @return A pre-configured JAX-RS client (no URL) with configured authorization.
|
||||||
*/
|
*/
|
||||||
public final javax.ws.rs.client.Client getClient() {
|
public final javax.ws.rs.client.Client getClient() {
|
||||||
return this.getClient(null);
|
synchronized (this.sync) {
|
||||||
|
if (this.client == null)
|
||||||
|
this.client = this.buildClient((AuthorizationFilter)null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.client;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,22 +54,51 @@ public abstract class Client {
|
|||||||
* @return A pre-configured JAX-RS client (no URL) with the specified authorization.
|
* @return A pre-configured JAX-RS client (no URL) with the specified authorization.
|
||||||
*/
|
*/
|
||||||
public javax.ws.rs.client.Client getClient(AuthorizationFilter authFilter) {
|
public javax.ws.rs.client.Client getClient(AuthorizationFilter authFilter) {
|
||||||
|
if (authFilter == null) {
|
||||||
|
return this.getClient();
|
||||||
|
} else {
|
||||||
|
return this.buildClient(authFilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param authFilter A dynamic authorization filter.
|
||||||
|
* @return A pre-configured JAX-RS client (no URL) with the specified authorization.
|
||||||
|
*/
|
||||||
|
public final javax.ws.rs.client.Client buildClient(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()
|
ClientBuilder clientBuilder = ClientBuilder.newBuilder()
|
||||||
.register(new JacksonJaxbJsonProvider());
|
.register(provider)
|
||||||
|
.register(new LoggingFilter());
|
||||||
|
|
||||||
if (authFilter == null)
|
if (authFilter == null)
|
||||||
authFilter = this.getConfig().createAuthorizationFilter();
|
authFilter = this.getConfig().createAuthorizationFilter();
|
||||||
if (authFilter != null)
|
if (authFilter != null)
|
||||||
clientBuilder.register(authFilter);
|
clientBuilder.register(authFilter);
|
||||||
|
this.buildClient(clientBuilder);
|
||||||
|
|
||||||
return clientBuilder.build();
|
return clientBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param clientBuilder A client builder
|
||||||
|
*/
|
||||||
|
public void buildClient(ClientBuilder clientBuilder) {
|
||||||
|
// for extension purposes
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return A pre-configured JAX-RS target (client w/ base URL) with configured authorization.
|
* @return A pre-configured JAX-RS target (client w/ base URL) with configured authorization.
|
||||||
*/
|
*/
|
||||||
public final WebTarget getTarget() {
|
public final WebTarget getTarget() {
|
||||||
return this.getTarget(null);
|
return this.getClient()
|
||||||
|
.target(this.getConfig().getBaseUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,14 +106,19 @@ public abstract class Client {
|
|||||||
* @return A pre-configured JAX-RS target (client w/ base URL) with the specified authorization.
|
* @return A pre-configured JAX-RS target (client w/ base URL) with the specified authorization.
|
||||||
*/
|
*/
|
||||||
public WebTarget getTarget(AuthorizationFilter authFilter) {
|
public WebTarget getTarget(AuthorizationFilter authFilter) {
|
||||||
return this.getClient(authFilter)
|
if (authFilter == null) {
|
||||||
.target(this.getConfig().getBaseUrl());
|
return this.getTarget();
|
||||||
|
} else {
|
||||||
|
return this.getClient(authFilter)
|
||||||
|
.target(this.getConfig().getBaseUrl());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method retrieves a JAX-RS implementation of the specified API.
|
* This method retrieves a JAX-RS implementation of the specified API.
|
||||||
*
|
*
|
||||||
* @param apiClass A JAX-RS annotation API class.
|
* @param <T> A JAX-RS annotated API class.
|
||||||
|
* @param apiClass A JAX-RS annotated API class.
|
||||||
* @return An instance of the API class.
|
* @return An instance of the API class.
|
||||||
*/
|
*/
|
||||||
public final <T> T getApi(Class<T> apiClass) {
|
public final <T> T getApi(Class<T> apiClass) {
|
||||||
@@ -67,8 +129,9 @@ public abstract class Client {
|
|||||||
* This method retrieves a JAX-RS implementation of the specified API with
|
* This method retrieves a JAX-RS implementation of the specified API with
|
||||||
* the specified authorization.
|
* the specified authorization.
|
||||||
*
|
*
|
||||||
|
* @param <T> A JAX-RS annotated API class.
|
||||||
* @param authFilter A dynamic authorization filter.
|
* @param authFilter A dynamic authorization filter.
|
||||||
* @param apiClass A JAX-RS annotation API class.
|
* @param apiClass A JAX-RS annotated API class.
|
||||||
* @return An instance of the API class.
|
* @return An instance of the API class.
|
||||||
*/
|
*/
|
||||||
public abstract <T> T getApi(AuthorizationFilter authFilter, Class<T> apiClass);
|
public abstract <T> T getApi(AuthorizationFilter authFilter, Class<T> apiClass);
|
||||||
|
@@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.inteligr8.rs;
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
@@ -99,6 +113,24 @@ public interface ClientConfiguration {
|
|||||||
return null;
|
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
|
* This method creates an authorization filter based on the configuration
|
||||||
* available. A configuration element is considered to not be available
|
* available. A configuration element is considered to not be available
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
package com.inteligr8.rs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This interface defines additional configurations specific to the Apache CXF
|
|
||||||
* JAX-RS library and its nuances.
|
|
||||||
*
|
|
||||||
* @author brian@inteligr8.com
|
|
||||||
*/
|
|
||||||
public interface ClientCxfConfiguration extends ClientConfiguration {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Apache CXF uses a global bus configuration where interceptors could
|
|
||||||
* wreck havoc on your implementation. This method allows you to
|
|
||||||
* explicitly by-pass the default bus.
|
|
||||||
*
|
|
||||||
* See https://cxf.apache.org/docs/bus-configuration.html.
|
|
||||||
*
|
|
||||||
* @return true to use the default bus; false otherwise.
|
|
||||||
*/
|
|
||||||
default boolean isDefaultBusEnabled() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.inteligr8.rs;
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
import javax.ws.rs.client.ClientRequestContext;
|
import javax.ws.rs.client.ClientRequestContext;
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
package com.inteligr8.rs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This interface defines additional configurations specific to the Jersey
|
|
||||||
* JAX-RS library and its nuances.
|
|
||||||
*
|
|
||||||
* @author brian@inteligr8.com
|
|
||||||
*/
|
|
||||||
public interface ClientJerseyConfiguration extends ClientConfiguration {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Jersey is automatically strict in its adherence to the ReST API
|
|
||||||
* specifications. It requires a body to PUT calls by default.
|
|
||||||
*
|
|
||||||
* @return true to require body in PUT calls; false to make it optional
|
|
||||||
*/
|
|
||||||
default boolean isPutBodyRequired() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.inteligr8.rs;
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
import javax.ws.rs.client.ClientRequestContext;
|
import javax.ws.rs.client.ClientRequestContext;
|
||||||
|
86
src/main/java/com/inteligr8/rs/LoggingFilter.java
Normal file
86
src/main/java/com/inteligr8/rs/LoggingFilter.java
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.ws.rs.client.ClientRequestContext;
|
||||||
|
import javax.ws.rs.client.ClientRequestFilter;
|
||||||
|
import javax.ws.rs.client.ClientResponseContext;
|
||||||
|
import javax.ws.rs.client.ClientResponseFilter;
|
||||||
|
import javax.ws.rs.core.Form;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is an JAX-RS filter for the logging of any JAX-RS request/response for
|
||||||
|
* debugging purposes. When used, it will write to 'jaxrs.request' and
|
||||||
|
* 'jaxrs.response' loggers at the 'trace' level.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
|
public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter {
|
||||||
|
|
||||||
|
private final Logger loggerRequest = LoggerFactory.getLogger("jaxrs.request");
|
||||||
|
private final Logger loggerResponse = LoggerFactory.getLogger("jaxrs.response");
|
||||||
|
|
||||||
|
protected final ObjectMapper om = new ObjectMapper().setSerializationInclusion(Include.NON_NULL);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void filter(ClientRequestContext requestContext) throws IOException {
|
||||||
|
if (this.loggerRequest.isTraceEnabled())
|
||||||
|
this.logAnyRequest(requestContext, this.loggerRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void logAnyRequest(ClientRequestContext requestContext, Logger logger) throws IOException {
|
||||||
|
if (MediaType.APPLICATION_JSON_TYPE.equals(requestContext.getMediaType())) {
|
||||||
|
logger.trace("request: {} {}: {}", requestContext.getMethod(), requestContext.getUri(),
|
||||||
|
this.om.writeValueAsString(requestContext.getEntity()));
|
||||||
|
} else if (MediaType.APPLICATION_FORM_URLENCODED_TYPE.equals(requestContext.getMediaType())) {
|
||||||
|
if (requestContext.getEntity() instanceof Form) {
|
||||||
|
logger.trace("request: {} {}: {}", requestContext.getMethod(), requestContext.getUri(),
|
||||||
|
((Form)requestContext.getEntity()).asMap());
|
||||||
|
} else {
|
||||||
|
this.loggerRequest.trace("request: {} {}: failed to output form", requestContext.getMethod(), requestContext.getUri());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.logUnhandledRequest(requestContext, logger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void logUnhandledRequest(ClientRequestContext requestContext, Logger logger) throws IOException {
|
||||||
|
if (requestContext.getMediaType() != null) {
|
||||||
|
logger.trace("request '{}': {} {}", requestContext.getMediaType(), requestContext.getMethod(), requestContext.getUri());
|
||||||
|
} else {
|
||||||
|
logger.trace("request: {} {}", requestContext.getMethod(), requestContext.getUri());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
|
||||||
|
if (this.loggerResponse.isTraceEnabled()) {
|
||||||
|
this.loggerResponse.trace("response: {} ", this.om.writeValueAsString(responseContext.getStatus()));
|
||||||
|
// WARN body is stream, which would need to be replaced after read
|
||||||
|
this.loggerResponse.warn("response: NOT YET SUPPORTED");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.inteligr8.rs;
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.inteligr8.rs;
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -101,6 +115,7 @@ public abstract class OAuthAuthorizationFilter implements AuthorizationFilter {
|
|||||||
form.param("client_secret", this.clientSecret);
|
form.param("client_secret", this.clientSecret);
|
||||||
if (this.scope != null)
|
if (this.scope != null)
|
||||||
form.param("scope", this.scope);
|
form.param("scope", this.scope);
|
||||||
|
this.extendRefreshTokenForm(form);
|
||||||
|
|
||||||
Entity<Form> entity = Entity.form(form);
|
Entity<Form> entity = Entity.form(form);
|
||||||
|
|
||||||
@@ -118,6 +133,7 @@ public abstract class OAuthAuthorizationFilter implements AuthorizationFilter {
|
|||||||
this.accessToken = (String)response.get("access_token");
|
this.accessToken = (String)response.get("access_token");
|
||||||
this.expiration = System.currentTimeMillis() + ((Number)response.get("expires_in")).longValue() * 1000L;
|
this.expiration = System.currentTimeMillis() + ((Number)response.get("expires_in")).longValue() * 1000L;
|
||||||
this.refreshToken = (String)response.get("refresh_token");
|
this.refreshToken = (String)response.get("refresh_token");
|
||||||
|
this.extendRefreshTokenResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Form createRefreshForm() {
|
protected Form createRefreshForm() {
|
||||||
@@ -127,4 +143,10 @@ public abstract class OAuthAuthorizationFilter implements AuthorizationFilter {
|
|||||||
|
|
||||||
protected abstract Form createForm();
|
protected abstract Form createForm();
|
||||||
|
|
||||||
|
protected void extendRefreshTokenForm(Form form) {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void extendRefreshTokenResponse(Map<String, Object> response) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.inteligr8.rs;
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
import javax.ws.rs.core.Form;
|
import javax.ws.rs.core.Form;
|
||||||
|
@@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.inteligr8.rs;
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
import javax.ws.rs.core.Form;
|
import javax.ws.rs.core.Form;
|
||||||
|
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface defines additional configurations specific to the Jersey
|
||||||
|
* JAX-RS library and its nuances.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
|
public interface ClientJerseyConfiguration extends ClientConfiguration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Jersey is automatically strict in its adherence to the ReST API
|
||||||
|
* specifications. It requires a body to PUT calls by default.
|
||||||
|
*
|
||||||
|
* @return true to require body in PUT calls; false to make it optional
|
||||||
|
*/
|
||||||
|
default boolean isPutBodyRequired() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,13 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.inteligr8.rs;
|
package com.inteligr8.rs;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.ws.rs.client.ClientBuilder;
|
||||||
import javax.ws.rs.ext.RuntimeDelegate;
|
import javax.ws.rs.ext.RuntimeDelegate;
|
||||||
|
|
||||||
import org.glassfish.jersey.client.ClientProperties;
|
import org.glassfish.jersey.client.ClientProperties;
|
||||||
import org.glassfish.jersey.client.proxy.WebResourceFactory;
|
import org.glassfish.jersey.client.proxy.WebResourceFactory;
|
||||||
import org.glassfish.jersey.internal.RuntimeDelegateImpl;
|
import org.glassfish.jersey.internal.RuntimeDelegateImpl;
|
||||||
|
import org.glassfish.jersey.media.multipart.MultiPartFeature;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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
|
* A class that provides pre-configured JAX-RS Client & WebTarget objects
|
||||||
@@ -15,22 +33,27 @@ import org.springframework.beans.factory.InitializingBean;
|
|||||||
*
|
*
|
||||||
* @author brian@inteligr8.com
|
* @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);
|
private final Logger logger = LoggerFactory.getLogger(ClientJerseyImpl.class);
|
||||||
|
|
||||||
@Override
|
private ClientJerseyConfiguration config;
|
||||||
protected abstract ClientJerseyConfiguration getConfig();
|
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public void afterPropertiesSet() {
|
* This constructor is for Spring or POJO use.
|
||||||
this.register();
|
* @param config The client configuration.
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
public ClientJerseyImpl(ClientJerseyConfiguration config) {
|
||||||
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method registers the Jersey library as the default provider for the
|
* This method registers the Jersey library as the default provider for the
|
||||||
* JAX-RS specification.
|
* JAX-RS specification.
|
||||||
*/
|
*/
|
||||||
|
@PostConstruct
|
||||||
public void register() {
|
public void register() {
|
||||||
if (RuntimeDelegate.getInstance() == null) {
|
if (RuntimeDelegate.getInstance() == null) {
|
||||||
this.logger.info("Setting JAX-RS runtime delegate to the Jersey library");
|
this.logger.info("Setting JAX-RS runtime delegate to the Jersey library");
|
||||||
@@ -47,19 +70,23 @@ public abstract class ClientJerseyImpl extends Client implements InitializingBea
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param authFilter A post-configuration authorization filter.
|
* @param clientBuilder A client builder.
|
||||||
* @return A JAX-RS client.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public javax.ws.rs.client.Client getClient(AuthorizationFilter authFilter) {
|
public void buildClient(ClientBuilder clientBuilder) {
|
||||||
javax.ws.rs.client.Client client = super.getClient(authFilter);
|
clientBuilder.register(MultiPartFeature.class);
|
||||||
|
|
||||||
if (!this.getConfig().isPutBodyRequired()) {
|
if (!this.getConfig().isPutBodyRequired()) {
|
||||||
// allow PUT operations without body data
|
// allow PUT operations without body data
|
||||||
client.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
|
clientBuilder.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return client;
|
/**
|
||||||
|
* @return The client configuration.
|
||||||
|
*/
|
||||||
|
public ClientJerseyConfiguration getConfig() {
|
||||||
|
return this.config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
Reference in New Issue
Block a user