summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBansal, Nitin (nb121v) <nitin.bansal@amdocs.com>2018-02-12 10:49:27 -0500
committerBansal, Nitin (nb121v) <nitin.bansal@amdocs.com>2018-02-12 10:54:20 -0500
commit390a620adb285f791d8c54140c2b06f04d2ac211 (patch)
tree145cb825bedf7df756a7583f648150d429d5c32c
parentec952dc6b9c88f65e32f1aa528a10b5f8045c838 (diff)
Fix apache camel IN/OUT headers
Fix RestClientProducer router-core component to pass IN/OUT headers Change-Id: I8a0d04007941cd5ab1ef07a609190ed997d84a56 Issue-ID: AAI-758 Signed-off-by: Bansal, Nitin (nb121v) <nitin.bansal@amdocs.com>
-rw-r--r--src/main/java/org/onap/aai/rest/RestClientProducer.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/org/onap/aai/rest/RestClientProducer.java b/src/main/java/org/onap/aai/rest/RestClientProducer.java
index c4cfce8..2a042d9 100644
--- a/src/main/java/org/onap/aai/rest/RestClientProducer.java
+++ b/src/main/java/org/onap/aai/rest/RestClientProducer.java
@@ -117,15 +117,16 @@ public class RestClientProducer extends DefaultProducer {
break;
}
- // Populate the OUT message with our result.
- exchange.getOut().setHeader(RestClientEndpoint.OUT_HEADER_RESPONSE_CODE,
+ /** Just use IN headers as camel does not pass incoming headers from IN to OUT so they might be lost .
+ Reference : http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html **/
+ exchange.getIn().setHeader(RestClientEndpoint.OUT_HEADER_RESPONSE_CODE,
result.getResultCode());
if (HttpUtil.isHttpResponseClassSuccess(result.getResultCode())) {
- exchange.getOut().setHeader(RestClientEndpoint.OUT_HEADER_RESPONSE_MSG,
+ exchange.getIn().setHeader(RestClientEndpoint.OUT_HEADER_RESPONSE_MSG,
responseStatusStringFromResult(result));
- exchange.getOut().setBody(result.getResult());
+ exchange.getIn().setBody(result.getResult());
} else {
- exchange.getOut().setHeader(RestClientEndpoint.OUT_HEADER_RESPONSE_MSG,
+ exchange.getIn().setHeader(RestClientEndpoint.OUT_HEADER_RESPONSE_MSG,
result.getFailureCause());
}