APinto
APinto

Reputation: 76

How to compress Camel HTTP responses?

I am using Camel's REST endpoint to implement HTTP endpoints. I want to enable HTTP payload compression on the responses, but haven't found a way to achieve it. If I add a marshall().gzip() bit to the routes, it does compress the payload but I end up with a compressed file instead!

Did anyone manage to implement HTTP compression in Camel?

Thank you!

AP

Upvotes: 1

Views: 1397

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55540

Depending on which http component you use for the rest component, then they may support automatic compression if you set the content-encoding header to be gzip compressed. For the jetty ought to support this.

There is a standard http syntax for that, usually that the content-encoding header has the word gzip included.

Camel uses this util method to determine that: org.apache.camel.util.GZIPHelper#isGzip(org.apache.camel.Message)

Upvotes: 2

Related Questions