How to remove the http protocol headers in the camel message?
In camel there are a number of components that use the http protocol headers to do their business. The components include camel-http, camel-jetty, camel-cxf, etc. If you are using these component, you may pay attention to the HTTP protocol headers:
Exchange.CONTENT_ENCODING
Exchange.CONTENT_TYPE
Exchange.HTTP_BASE_URI
Exchange.HTTP_CHARACTER_ENCODING
Exchange.HTTP_METHOD
Exchange.HTTP_PATH
Exchange.HTTP_QUERY
Exchange.HTTP_RESPONSE_CODE
If you don’t want these headers to bother your other endpoints, you can remove these headers as follows:
from("jetty://http://myhost:9000/myservice/")
.removeHeaders("CamelHttp*")
.to("otherEndpoint");
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="jetty://http://myhost:9000/myservice/"/>
<removeHeaders pattern="CamelHttp*" />
<to uri="otherEndpoint"/>
</route>
</camelContext>