I am using apache camel for rest service calls from spring
Now we need to send the json request in our body to be passed in GZIP using apache camel. I tried by adding CONTENT_ENCODING as gzip, but it does not work. Please see the code
public void process(Exchange exchange) { exchange.setPattern(ExchangePattern.InOut); exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8"); Message inMessage = exchange.getIn(); inMessage.setHeader(ACCEPT_HEADER, "application/json"); inMessage.setHeader(CONTENT_TYPE, "application/json"); inMessage.setHeader(Constants.ACCEPT_ENCODING, Constants.ACCEPT_ENCODING_TYPE); inMessage.setHeader(Exchange.CONTENT_ENCODING, "gzip"); inMessage.setBody(body);
In the camelContext.xml,
we have defined
<route streamCache="true">
<from uri="direct:setUpload" />
<recipientList>
<simple>cxfrs://{{uploadSample.url}}?throwExceptionOnFailure=false</simple>
</recipientList>
<unmarshal ref="sampleParser" />
</route>
Do we need to set any other things to gzip the body JSON request
Please help how to correct this
Regards Hari