summaryrefslogtreecommitdiffstats
path: root/prh-aai-client
diff options
context:
space:
mode:
Diffstat (limited to 'prh-aai-client')
-rw-r--r--prh-aai-client/pom.xml14
-rw-r--r--prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClient.java15
2 files changed, 20 insertions, 9 deletions
diff --git a/prh-aai-client/pom.xml b/prh-aai-client/pom.xml
index b86e9048..f08fed32 100644
--- a/prh-aai-client/pom.xml
+++ b/prh-aai-client/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.dcaegen2.services</groupId>
<artifactId>prh</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.1-SNAPSHOT</version>
</parent>
<groupId>org.onap.dcaegen2.services.prh</groupId>
@@ -48,10 +48,18 @@
</dependency>
<dependency>
<groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
</dependency>
<dependency>
@@ -59,6 +67,10 @@
<artifactId>spring-boot-starter-reactor-netty</artifactId>
</dependency>
<dependency>
+ <groupId>io.projectreactor.netty</groupId>
+ <artifactId>reactor-netty</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.onap.dcaegen2.services.prh</groupId>
<artifactId>prh-commons</artifactId>
<version>${project.version}</version>
diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClient.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClient.java
index 0dfe1f9e..256aa3b9 100644
--- a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClient.java
+++ b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClient.java
@@ -35,7 +35,9 @@ import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
+import org.springframework.http.client.reactive.ClientHttpConnector;
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
+import org.springframework.http.client.reactive.ReactorResourceFactory;
import org.springframework.web.reactive.function.client.ExchangeFilterFunction;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
@@ -68,18 +70,15 @@ public class AaiReactiveWebClient {
* @return WebClient
*/
public WebClient build() throws SSLException {
- SslContext sslContext;
- sslContext = SslContextBuilder
+ LOGGER.debug("Setting ssl context");
+ SslContext sslContext = SslContextBuilder
.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE)
.build();
- LOGGER.debug("Setting ssl context");
-
+ ClientHttpConnector reactorClientHttpConnector = new ReactorClientHttpConnector(new ReactorResourceFactory(),
+ httpClient -> httpClient.secure(sslContextSpec -> sslContextSpec.sslContext(sslContext)));
return WebClient.builder()
- .clientConnector(new ReactorClientHttpConnector(clientOptions -> {
- clientOptions.sslContext(sslContext);
- clientOptions.disablePool();
- }))
+ .clientConnector(reactorClientHttpConnector)
.defaultHeaders(httpHeaders -> httpHeaders.setAll(aaiHeaders))
.filter(basicAuthentication(aaiUserName, aaiUserPassword))
.filter(logRequest())