Loading pom.xml +5 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,11 @@ </properties> <dependencies> <dependency> <groupId>javax.annotation</groupId> <artifactId>javax.annotation-api</artifactId> <version>1.3.2</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> Loading src/main/java/com/inteligr8/rs/Client.java +0 −4 Original line number Diff line number Diff line Loading @@ -72,9 +72,6 @@ public abstract class Client { this.getConfig().configureJacksonMapper(om); JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(om, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS); provider.enable(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL); provider.disable(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE); this.getConfig().configureJacksonProvider(provider); if (this.getConfig().isWrapRootValueEnabled()) Loading @@ -91,7 +88,6 @@ public abstract class Client { if (authFilter != null) clientBuilder.register(authFilter); this.buildClient(clientBuilder); this.getConfig().configureClient(clientBuilder); return clientBuilder.build(); Loading src/main/java/com/inteligr8/rs/ClientImpl.java 0 → 100644 +83 −0 Original line number Diff line number Diff line /* * 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; import javax.ws.rs.client.ClientBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * A class that provides pre-configured JAX-RS Client & WebTarget objects * for Jersey. * * @author brian@inteligr8.com */ @Component("client.jaxrs") public class ClientImpl extends Client { private final Logger logger = LoggerFactory.getLogger(ClientImpl.class); private ClientConfiguration config; /** * This constructor is for Spring or POJO use. * @param config The client configuration. */ @Autowired public ClientImpl(ClientConfiguration config) { this.config = config; } /** * This method registers the Jersey library as the default provider for the * JAX-RS specification. */ @PostConstruct public void register() { this.logger.info("API Base URL: {}", this.getConfig().getBaseUrl()); } /** * @param clientBuilder A client builder. */ @Override public void buildClient(ClientBuilder clientBuilder) { } /** * @return The client configuration. */ public ClientConfiguration getConfig() { return this.config; } /** * This method retrieves a JAX-RS implementation of the specified API with * the specified authorization. * * @param authFilter A dynamic authorization filter. * @param apiClass A JAX-RS annotation API class. * @return An instance of the API class. */ @Override public <T> T getApi(AuthorizationFilter authFilter, Class<T> apiClass) { throw new UnsupportedOperationException(); } } src/main/java/com/inteligr8/rs/LoggingFilter.java +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter logger.trace("request: {} {}: {}", requestContext.getMethod(), requestContext.getUri(), ((Form)requestContext.getEntity()).asMap()); } else { this.loggerRequest.trace("request: {} {}: failed to output form", requestContext.getMethod(), requestContext.getUri()); logger.trace("request: {} {}: failed to output form", requestContext.getMethod(), requestContext.getUri()); } } else { this.logUnhandledRequest(requestContext, logger); Loading src/main/java/com/inteligr8/rs/OAuthAuthorizationCodeAuthorizationFilter.java +6 −2 Original line number Diff line number Diff line Loading @@ -74,11 +74,15 @@ public class OAuthAuthorizationCodeAuthorizationFilter extends OAuthAuthorizatio @Override protected Form createForm() { Form form = new Form().param("grant_type", "authorization_code") .param("code", this.code); Form form = new Form().param("grant_type", "authorization_code"); if (this.redirectUri != null) form.param("redirect_uri", this.redirectUri.toString()); return form; } @Override protected void extendFormSensitive(Form form) { form.param("code", this.code); } } Loading
pom.xml +5 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,11 @@ </properties> <dependencies> <dependency> <groupId>javax.annotation</groupId> <artifactId>javax.annotation-api</artifactId> <version>1.3.2</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> Loading
src/main/java/com/inteligr8/rs/Client.java +0 −4 Original line number Diff line number Diff line Loading @@ -72,9 +72,6 @@ public abstract class Client { this.getConfig().configureJacksonMapper(om); JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(om, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS); provider.enable(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL); provider.disable(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE); this.getConfig().configureJacksonProvider(provider); if (this.getConfig().isWrapRootValueEnabled()) Loading @@ -91,7 +88,6 @@ public abstract class Client { if (authFilter != null) clientBuilder.register(authFilter); this.buildClient(clientBuilder); this.getConfig().configureClient(clientBuilder); return clientBuilder.build(); Loading
src/main/java/com/inteligr8/rs/ClientImpl.java 0 → 100644 +83 −0 Original line number Diff line number Diff line /* * 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; import javax.ws.rs.client.ClientBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * A class that provides pre-configured JAX-RS Client & WebTarget objects * for Jersey. * * @author brian@inteligr8.com */ @Component("client.jaxrs") public class ClientImpl extends Client { private final Logger logger = LoggerFactory.getLogger(ClientImpl.class); private ClientConfiguration config; /** * This constructor is for Spring or POJO use. * @param config The client configuration. */ @Autowired public ClientImpl(ClientConfiguration config) { this.config = config; } /** * This method registers the Jersey library as the default provider for the * JAX-RS specification. */ @PostConstruct public void register() { this.logger.info("API Base URL: {}", this.getConfig().getBaseUrl()); } /** * @param clientBuilder A client builder. */ @Override public void buildClient(ClientBuilder clientBuilder) { } /** * @return The client configuration. */ public ClientConfiguration getConfig() { return this.config; } /** * This method retrieves a JAX-RS implementation of the specified API with * the specified authorization. * * @param authFilter A dynamic authorization filter. * @param apiClass A JAX-RS annotation API class. * @return An instance of the API class. */ @Override public <T> T getApi(AuthorizationFilter authFilter, Class<T> apiClass) { throw new UnsupportedOperationException(); } }
src/main/java/com/inteligr8/rs/LoggingFilter.java +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter logger.trace("request: {} {}: {}", requestContext.getMethod(), requestContext.getUri(), ((Form)requestContext.getEntity()).asMap()); } else { this.loggerRequest.trace("request: {} {}: failed to output form", requestContext.getMethod(), requestContext.getUri()); logger.trace("request: {} {}: failed to output form", requestContext.getMethod(), requestContext.getUri()); } } else { this.logUnhandledRequest(requestContext, logger); Loading
src/main/java/com/inteligr8/rs/OAuthAuthorizationCodeAuthorizationFilter.java +6 −2 Original line number Diff line number Diff line Loading @@ -74,11 +74,15 @@ public class OAuthAuthorizationCodeAuthorizationFilter extends OAuthAuthorizatio @Override protected Form createForm() { Form form = new Form().param("grant_type", "authorization_code") .param("code", this.code); Form form = new Form().param("grant_type", "authorization_code"); if (this.redirectUri != null) form.param("redirect_uri", this.redirectUri.toString()); return form; } @Override protected void extendFormSensitive(Form form) { form.param("code", this.code); } }