diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java/org')
-rw-r--r-- | bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java index 74b1c3f802..1436d83a94 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java @@ -157,14 +157,9 @@ public abstract class RestClient { } client.register(this.getMapper()); Optional<ClientResponseFilter> responseFilter = this.addResponseFilter(); - if (responseFilter.isPresent()) { - client.register(responseFilter.get()); - } - if (!path.isPresent()) { - webTarget = client.target(host.toString()); - } else { - webTarget = client.target(UriBuilder.fromUri(host + path.get().toString())); - } + responseFilter.ifPresent(clientResponseFilter -> client.register(clientResponseFilter)); + webTarget = path.<WebTarget>map(uri -> client.target(UriBuilder.fromUri(host + uri.toString()))) + .orElseGet(() -> client.target(host.toString())); this.accept = MediaType.APPLICATION_JSON; this.contentType = MediaType.APPLICATION_JSON; } |