From 390a620adb285f791d8c54140c2b06f04d2ac211 Mon Sep 17 00:00:00 2001 From: "Bansal, Nitin (nb121v)" Date: Mon, 12 Feb 2018 10:49:27 -0500 Subject: 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) --- src/main/java/org/onap/aai/rest/RestClientProducer.java | 11 ++++++----- 1 file 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()); } -- cgit 1.2.3-korg