Compare commits

...

8 Commits

4 changed files with 14 additions and 14 deletions

View File

@@ -6,7 +6,7 @@
<groupId>com.inteligr8</groupId> <groupId>com.inteligr8</groupId>
<artifactId>common-rest-client</artifactId> <artifactId>common-rest-client</artifactId>
<version>3.0.2-jersey</version> <version>3.0.3-jersey</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>ReST API Client for Java</name> <name>ReST API Client for Java</name>

View File

@@ -30,7 +30,7 @@ import jakarta.ws.rs.client.ClientRequestContext;
*/ */
public class HeaderAuthorizationFilter implements AuthorizationFilter { public class HeaderAuthorizationFilter implements AuthorizationFilter {
private final MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); private final MultiValueMap<String, Object> headers = new LinkedMultiValueMap<>();
/** /**
* This constructor instantiates the filter with required fields. * This constructor instantiates the filter with required fields.
@@ -38,7 +38,7 @@ public class HeaderAuthorizationFilter implements AuthorizationFilter {
* @param headerName A header name. * @param headerName A header name.
* @param headerValue A header value. * @param headerValue A header value.
*/ */
public HeaderAuthorizationFilter(String headerName, String headerValue) { public HeaderAuthorizationFilter(String headerName, Object headerValue) {
this.headers.add(headerName, headerValue); this.headers.add(headerName, headerValue);
} }
@@ -49,7 +49,7 @@ public class HeaderAuthorizationFilter implements AuthorizationFilter {
* @param headerValue A header value. * @param headerValue A header value.
* @return This class for fluent chaining. * @return This class for fluent chaining.
*/ */
public HeaderAuthorizationFilter add(String headerName, String headerValue) { public HeaderAuthorizationFilter add(String headerName, Object headerValue) {
this.headers.add(headerName, headerValue); this.headers.add(headerName, headerValue);
return this; return this;
} }
@@ -61,8 +61,8 @@ public class HeaderAuthorizationFilter implements AuthorizationFilter {
*/ */
@Override @Override
public void filter(ClientRequestContext requestContext) throws UnsupportedEncodingException { public void filter(ClientRequestContext requestContext) throws UnsupportedEncodingException {
for (Entry<String, List<String>> header : this.headers.entrySet()) for (Entry<String, List<Object>> header : this.headers.entrySet())
requestContext.getHeaders().addAll(header.getKey(), header.getValue()); requestContext.getHeaders().put(header.getKey(), header.getValue());
} }
} }

View File

@@ -16,7 +16,7 @@ package com.inteligr8.rs;
/** /**
* This interface defines additional configurations specific to the Jersey * This interface defines additional configurations specific to the Jersey
* JAX-RS library and its nuances. * Jakarta RS library and its nuances.
* *
* @author brian@inteligr8.com * @author brian@inteligr8.com
*/ */

View File

@@ -47,17 +47,17 @@ public class ClientJerseyImpl extends Client {
/** /**
* 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. * Jakarta RS specification.
*/ */
@PostConstruct @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 Jakarta RS runtime delegate to the Jersey library");
RuntimeDelegate.setInstance(new RuntimeDelegateImpl()); RuntimeDelegate.setInstance(new RuntimeDelegateImpl());
} else if (RuntimeDelegate.getInstance() instanceof RuntimeDelegateImpl) { } else if (RuntimeDelegate.getInstance() instanceof RuntimeDelegateImpl) {
this.logger.info("JAX-RS runtime delegate already the Jersey library"); this.logger.info("Jakarta RS runtime delegate already the Jersey library");
} else { } else {
this.logger.warn("Setting JAX-RS runtime delegate to the Jersey library; was: " + RuntimeDelegate.getInstance().getClass().getName()); this.logger.warn("Setting Jakarta RS runtime delegate to the Jersey library; was: " + RuntimeDelegate.getInstance().getClass().getName());
RuntimeDelegate.setInstance(new RuntimeDelegateImpl()); RuntimeDelegate.setInstance(new RuntimeDelegateImpl());
} }
@@ -86,11 +86,11 @@ public class ClientJerseyImpl extends Client {
} }
/** /**
* This method retrieves a JAX-RS implementation of the specified API with * This method retrieves a Jakarta RS implementation of the specified API
* the specified authorization. * with the specified authorization.
* *
* @param authFilter A dynamic authorization filter. * @param authFilter A dynamic authorization filter.
* @param apiClass A JAX-RS annotation API class. * @param apiClass A Jakarta RS annotation API class.
* @return An instance of the API class. * @return An instance of the API class.
*/ */
@Override @Override