diff options
author | pwielebs <piotr.wielebski@nokia.com> | 2018-04-24 10:07:41 +0200 |
---|---|---|
committer | pwielebs <piotr.wielebski@nokia.com> | 2018-04-24 10:09:36 +0200 |
commit | 74c5bf5b2f99043a8cb29aa8f2b9fde253b92e72 (patch) | |
tree | 1ddeb70f2943086c1196317ccf5dfc43cf301470 /prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java | |
parent | a274374b520aad75c99cdce7f4f9ebc31ce74343 (diff) |
Http clients refactoring
Change-Id: Ibed4b83fd508dd8666b76bdf590069d40dd3a363
Issue-ID: DCAEGEN2-451
Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java')
-rw-r--r-- | prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java index 30d7ad86..5acf2042 100644 --- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java +++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java @@ -50,7 +50,7 @@ public class ExtendedDmaapConsumerHttpClientImpl { private final String dmaapContentType; - public ExtendedDmaapConsumerHttpClientImpl(DmaapConsumerConfiguration configuration) { + ExtendedDmaapConsumerHttpClientImpl(DmaapConsumerConfiguration configuration) { this.closeableHttpClient = new DmaapHttpClientImpl(configuration).getHttpClient(); this.dmaapHostName = configuration.dmaapHostName(); this.dmaapProtocol = configuration.dmaapProtocol(); @@ -72,11 +72,7 @@ public class ExtendedDmaapConsumerHttpClientImpl { logger.error("Exception while executing HTTP request: {}", e); } - if (extendedDetails.isPresent()) { - return extendedDetails; - } else { - return Optional.empty(); - } + return extendedDetails; } private static HttpRequestBase createHttpRequest(URI extendedURI) { @@ -97,7 +93,7 @@ public class ExtendedDmaapConsumerHttpClientImpl { final URI extendedURI = createDmaapConsumerExtendedURI(); if ("application/json".equals(dmaapContentType)) { - request = Optional.of(createHttpRequest(extendedURI)); + request = Optional.ofNullable(createHttpRequest(extendedURI)); request.get().addHeader("Content-type", dmaapContentType); } @@ -118,8 +114,8 @@ public class ExtendedDmaapConsumerHttpClientImpl { .setPath(createRequestPath()); try { - logger.info("Building extended URI"); extendedURI = uriBuilder.build(); + logger.info("Building extended URI: {}", extendedURI); } catch (URISyntaxException e) { logger.error("Exception while building extended URI: {}", e); } |