Merge branch 'develop' into stable
This commit is contained in:
commit
a574154c20
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,6 +2,9 @@
|
||||
target
|
||||
pom.xml.versionsBackup
|
||||
|
||||
# Maven Invoker
|
||||
build.log
|
||||
|
||||
# Eclipse
|
||||
.project
|
||||
.classpath
|
||||
|
156
pom-release.xml
Normal file
156
pom-release.xml
Normal file
@ -0,0 +1,156 @@
|
||||
<?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-SNAPSHOT</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>
|
||||
</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>
|
60
pom.xml
60
pom.xml
@ -1,11 +1,42 @@
|
||||
<?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.0</version>
|
||||
<packaging>jar</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>
|
||||
@ -124,6 +155,16 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</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>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<executions>
|
||||
@ -144,7 +185,6 @@
|
||||
<profile>
|
||||
<id>jaxrs-jersey</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
<property>
|
||||
<name>jaxrs.impl</name>
|
||||
<value>jersey</value>
|
||||
@ -203,22 +243,4 @@
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>inteligr8-public</id>
|
||||
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>inteligr8-releases</id>
|
||||
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>inteligr8-snapshots</id>
|
||||
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
||||
import java.util.LinkedList;
|
||||
@ -31,7 +45,8 @@ public class ClientCxfImpl extends Client {
|
||||
private ClientCxfConfiguration config;
|
||||
|
||||
/**
|
||||
* This constructor is for Spring or POJO use
|
||||
* This constructor is for Spring or POJO use.
|
||||
* @param config The client configuration.
|
||||
*/
|
||||
@Autowired
|
||||
public ClientCxfImpl(ClientCxfConfiguration config) {
|
||||
@ -97,10 +112,16 @@ public class ClientCxfImpl extends 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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -11,6 +25,14 @@ 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
|
||||
|
@ -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;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
@ -11,6 +25,12 @@ 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
|
||||
@ -18,12 +38,12 @@ public class CxfMultipartProvider extends MultipartProvider {
|
||||
|
||||
@Override
|
||||
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
|
||||
return MultipartBody.class.isAssignableFrom(type) || this.isReadable(type, genericType, annotations, 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) || this.isWriteable(type, genericType, annotations, 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;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
import javax.ws.rs.client.ClientRequestContext;
|
||||
|
@ -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;
|
||||
|
||||
import javax.ws.rs.client.ClientBuilder;
|
||||
@ -18,6 +32,9 @@ public abstract class Client {
|
||||
private final Object sync = new Object();
|
||||
private javax.ws.rs.client.Client client;
|
||||
|
||||
/**
|
||||
* @return The client configuration.
|
||||
*/
|
||||
public abstract ClientConfiguration getConfig();
|
||||
|
||||
/**
|
||||
@ -69,6 +86,9 @@ public abstract class Client {
|
||||
return clientBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clientBuilder A client builder
|
||||
*/
|
||||
public void buildClient(ClientBuilder clientBuilder) {
|
||||
// for extension purposes
|
||||
}
|
||||
@ -97,7 +117,8 @@ public abstract class Client {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public final <T> T getApi(Class<T> apiClass) {
|
||||
@ -108,8 +129,9 @@ public abstract class Client {
|
||||
* This method retrieves a JAX-RS implementation of the specified API with
|
||||
* the specified authorization.
|
||||
*
|
||||
* @param <T> A JAX-RS annotated API class.
|
||||
* @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.
|
||||
*/
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
import javax.ws.rs.client.ClientRequestContext;
|
||||
|
@ -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;
|
||||
|
||||
import javax.ws.rs.client.ClientRequestContext;
|
||||
|
@ -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;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -15,6 +29,13 @@ 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");
|
||||
|
@ -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;
|
||||
|
||||
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;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -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;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@ -27,7 +41,8 @@ public class ClientJerseyImpl extends Client {
|
||||
private ClientJerseyConfiguration config;
|
||||
|
||||
/**
|
||||
* This constructor is for Spring or POJO use
|
||||
* This constructor is for Spring or POJO use.
|
||||
* @param config The client configuration.
|
||||
*/
|
||||
@Autowired
|
||||
public ClientJerseyImpl(ClientJerseyConfiguration config) {
|
||||
@ -54,6 +69,9 @@ public class ClientJerseyImpl extends Client {
|
||||
this.logger.info("API Base URL: " + this.getConfig().getBaseUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clientBuilder A client builder.
|
||||
*/
|
||||
@Override
|
||||
public void buildClient(ClientBuilder clientBuilder) {
|
||||
clientBuilder.register(MultiPartFeature.class);
|
||||
@ -64,6 +82,9 @@ public class ClientJerseyImpl extends Client {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The client configuration.
|
||||
*/
|
||||
public ClientJerseyConfiguration getConfig() {
|
||||
return this.config;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user