summaryrefslogtreecommitdiffstats
path: root/restapi-call-node/provider/src/main/java/org
diff options
context:
space:
mode:
authorSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>2019-02-14 20:10:03 +0000
committerSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>2019-02-14 20:10:03 +0000
commit35f6854436afefc3083acd665689b00abd49a060 (patch)
tree603fc91a167585c3d99835b16ead5a6f59d0252e /restapi-call-node/provider/src/main/java/org
parent77a8961d8a40afb557814802264aaab50291807f (diff)
RestApiCallNode header changes
allow the http header Accept to be set independently from the http header Content-Type Change-Id: I66fd846cec065a12afe7111c644aa373b61cf424 Issue-ID: CCSDK-1077 Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Diffstat (limited to 'restapi-call-node/provider/src/main/java/org')
-rw-r--r--restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java1
-rw-r--r--restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java20
2 files changed, 13 insertions, 8 deletions
diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java
index d3fec37ee..8f65cf261 100644
--- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java
+++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java
@@ -50,4 +50,5 @@ public class Parameters {
public String oAuthVersion;
public AuthType authtype;
public Boolean returnRequestPayload;
+ public String accept;
}
diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java
index 83b12c767..4c04c9d3b 100644
--- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java
+++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java
@@ -165,6 +165,8 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
false, null));
p.returnRequestPayload = valueOf(parseParam(
paramMap, "returnRequestPayload", false, null));
+ p.accept = parseParam(paramMap, "accept",
+ false, null);
return p;
}
@@ -631,14 +633,16 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
r.code = 200;
if (!p.skipSending) {
- String tt = p.format == Format.XML ? "application/xml" : "application/json";
- String tt1 = tt + ";charset=UTF-8";
- if (p.contentType != null) {
- tt = p.contentType;
- tt1 = p.contentType;
+ String accept = p.accept;
+ if(accept == null) {
+ accept = p.format == Format.XML ? "application/xml" : "application/json";
+ }
+ String contentType = p.contentType;
+ if(contentType == null) {
+ contentType = accept + ";charset=UTF-8";
}
- Invocation.Builder invocationBuilder = webTarget.request(tt1).accept(tt);
+ Invocation.Builder invocationBuilder = webTarget.request(contentType).accept(accept);
if (p.format == Format.NONE) {
invocationBuilder.header("", "");
@@ -658,7 +662,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
Response response;
try {
- response = invocationBuilder.method(p.httpMethod.toString(), entity(request, tt1));
+ response = invocationBuilder.method(p.httpMethod.toString(), entity(request, contentType));
} catch (ProcessingException | IllegalStateException e) {
throw new SvcLogicException(requestPostingException +
e.getLocalizedMessage(), e);
@@ -1012,4 +1016,4 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
public String responsePrefix;
public boolean skipSending;
}
-} \ No newline at end of file
+}