You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2022/03/29 16:59:47 UTC

[camel] 04/12: CAMEL-17792: Add doc about the message headers of camel-http

This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers
in repository https://gitbox.apache.org/repos/asf/camel.git

commit eac4ec0377162309b3ad6938006927c97b469b1a
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Tue Mar 29 13:05:44 2022 +0200

    CAMEL-17792: Add doc about the message headers of camel-http
---
 .../org/apache/camel/component/http/http.json      | 16 ++++++++
 .../org/apache/camel/component/http/https.json     | 16 ++++++++
 .../camel-http/src/main/docs/http-component.adoc   | 36 ++---------------
 .../apache/camel/component/http/HttpConstants.java | 47 ++++++++++++++++++++++
 .../apache/camel/component/http/HttpEndpoint.java  |  2 +-
 .../camel/component/http/HttpEntityConverter.java  |  6 +--
 .../camel/component/http/HttpPollingConsumer.java  |  4 +-
 .../apache/camel/component/http/HttpProducer.java  | 32 +++++++--------
 .../component/http/helper/HttpMethodHelper.java    |  7 ++--
 9 files changed, 108 insertions(+), 58 deletions(-)

diff --git a/components/camel-http/src/generated/resources/org/apache/camel/component/http/http.json b/components/camel-http/src/generated/resources/org/apache/camel/component/http/http.json
index 925c1cd..c03ae78 100644
--- a/components/camel-http/src/generated/resources/org/apache/camel/component/http/http.json
+++ b/components/camel-http/src/generated/resources/org/apache/camel/component/http/http.json
@@ -63,6 +63,22 @@
     "connectTimeout": { "kind": "property", "displayName": "Connect Timeout", "group": "timeout", "label": "timeout", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": -1, "description": "Determines the timeout in milliseconds until a connection is established. A timeout value of zero is interpreted as an infinite timeout. A timeout value of zero is interpreted as an infinite timeout. A negative value is int [...]
     "socketTimeout": { "kind": "property", "displayName": "Socket Timeout", "group": "timeout", "label": "timeout", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": -1, "description": "Defines the socket timeout in milliseconds, which is the timeout for waiting for data or, put differently, a maximum period inactivity between two consecutive data packets). A timeout value of zero is interpreted as an infini [...]
   },
+  "headers": {
+    "Content-Encoding": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The HTTP content encoding. Is set on both the IN and OUT message to\nprovide a content encoding, such as `gzip`." },
+    "CamelHttpResponseCode": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The HTTP response code from the external server. Is 200 for OK." },
+    "CamelHttpResponseText": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The HTTP response text from the external server." },
+    "CamelHttpQuery": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "URI parameters. Will override existing URI parameters set directly on\nthe endpoint." },
+    "CamelHttpProtocolVersion": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The version of the http protocol used." },
+    "Host": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The target host." },
+    "CamelRestHttpUri": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The rest http URI." },
+    "CamelHttpUri": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "URI to call. Will override existing URI set directly on the endpoint.\nThis uri is the uri of the http server to call. Its not the same as the\nCamel endpoint uri, where you can configure endpoint options such as\nsecurity etc. This header does not supp [...]
+    "CamelHttpPath": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Request URI's path, the header will be used to build the request URI\nwith the HTTP_URI." },
+    "CamelRestHttpQuery": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The rest http query." },
+    "CamelHttpRawQuery": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The http raw query." },
+    "CamelHttpMethod": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.apache.camel.component.http.HttpMethods", "enum": [ "GET", "PATCH", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "TRACE" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The http method to use." },
+    "CamelHttpCharacterEncoding": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The character encoding." },
+    "Content-Type": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The HTTP content type. Is set on both the IN and OUT message to provide\na content type, such as `text\/html`." }
+  },
   "properties": {
     "httpUri": { "kind": "path", "displayName": "Http Uri", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.net.URI", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The url of the HTTP endpoint to call." },
     "headerFilterStrategy": { "kind": "parameter", "displayName": "Header Filter Strategy", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom HeaderFilterStrategy to filter header to and from Camel message." },
diff --git a/components/camel-http/src/generated/resources/org/apache/camel/component/http/https.json b/components/camel-http/src/generated/resources/org/apache/camel/component/http/https.json
index 24f3de2..8efdb5e 100644
--- a/components/camel-http/src/generated/resources/org/apache/camel/component/http/https.json
+++ b/components/camel-http/src/generated/resources/org/apache/camel/component/http/https.json
@@ -63,6 +63,22 @@
     "connectTimeout": { "kind": "property", "displayName": "Connect Timeout", "group": "timeout", "label": "timeout", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": -1, "description": "Determines the timeout in milliseconds until a connection is established. A timeout value of zero is interpreted as an infinite timeout. A timeout value of zero is interpreted as an infinite timeout. A negative value is int [...]
     "socketTimeout": { "kind": "property", "displayName": "Socket Timeout", "group": "timeout", "label": "timeout", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": -1, "description": "Defines the socket timeout in milliseconds, which is the timeout for waiting for data or, put differently, a maximum period inactivity between two consecutive data packets). A timeout value of zero is interpreted as an infini [...]
   },
+  "headers": {
+    "Content-Encoding": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The HTTP content encoding. Is set on both the IN and OUT message to\nprovide a content encoding, such as `gzip`." },
+    "CamelHttpResponseCode": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The HTTP response code from the external server. Is 200 for OK." },
+    "CamelHttpResponseText": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The HTTP response text from the external server." },
+    "CamelHttpQuery": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "URI parameters. Will override existing URI parameters set directly on\nthe endpoint." },
+    "CamelHttpProtocolVersion": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The version of the http protocol used." },
+    "Host": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The target host." },
+    "CamelRestHttpUri": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The rest http URI." },
+    "CamelHttpUri": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "URI to call. Will override existing URI set directly on the endpoint.\nThis uri is the uri of the http server to call. Its not the same as the\nCamel endpoint uri, where you can configure endpoint options such as\nsecurity etc. This header does not supp [...]
+    "CamelHttpPath": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Request URI's path, the header will be used to build the request URI\nwith the HTTP_URI." },
+    "CamelRestHttpQuery": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The rest http query." },
+    "CamelHttpRawQuery": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The http raw query." },
+    "CamelHttpMethod": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.apache.camel.component.http.HttpMethods", "enum": [ "GET", "PATCH", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "TRACE" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The http method to use." },
+    "CamelHttpCharacterEncoding": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The character encoding." },
+    "Content-Type": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The HTTP content type. Is set on both the IN and OUT message to provide\na content type, such as `text\/html`." }
+  },
   "properties": {
     "httpUri": { "kind": "path", "displayName": "Http Uri", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.net.URI", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The url of the HTTP endpoint to call." },
     "headerFilterStrategy": { "kind": "parameter", "displayName": "Header Filter Strategy", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom HeaderFilterStrategy to filter header to and from Camel message." },
diff --git a/components/camel-http/src/main/docs/http-component.adoc b/components/camel-http/src/main/docs/http-component.adoc
index 8aa2d69..2371a63 100644
--- a/components/camel-http/src/main/docs/http-component.adoc
+++ b/components/camel-http/src/main/docs/http-component.adoc
@@ -52,43 +52,15 @@ include::partial$component-endpoint-options.adoc[]
 
 // endpoint options: END
 
-
-== Message Headers
-
-[width="100%",cols="10%,20%,70%",options="header",]
-|=======================================================================
-|Name |Type |Description
-
-|`Exchange.HTTP_URI` |`String` |URI to call. Will override existing URI set directly on the endpoint.
-This uri is the uri of the http server to call. Its not the same as the
-Camel endpoint uri, where you can configure endpoint options such as
-security etc. This header does not support that, its only the uri of the
-http server.
-
-|`Exchange.HTTP_PATH` |`String` |Request URI's path, the header will be used to build the request URI
-with the HTTP_URI.
-
-|`Exchange.HTTP_QUERY` |`String` |URI parameters. Will override existing URI parameters set directly on
-the endpoint.
-
-|`Exchange.HTTP_RESPONSE_CODE` |`int` |The HTTP response code from the external server. Is 200 for OK.
-
-|`Exchange.HTTP_RESPONSE_TEXT` | `String` |The HTTP response text from the external server.
-
-|`Exchange.HTTP_CHARACTER_ENCODING` |`String` |Character encoding.
-
-|`Exchange.CONTENT_TYPE` |`String` |The HTTP content type. Is set on both the IN and OUT message to provide
-a content type, such as `text/html`.
-
-|`Exchange.CONTENT_ENCODING` |`String` |The HTTP content encoding. Is set on both the IN and OUT message to
-provide a content encoding, such as `gzip`.
-|=======================================================================
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
 
 == Message Body
 
 Camel will store the HTTP response from the external server on the OUT
 body. All headers from the IN message will be copied to the OUT message,
-so headers are preserved during routing. Additionally Camel will add the
+so headers are preserved during routing. Additionally, Camel will add the
 HTTP response headers as well to the OUT message headers.
 
 == Using System Properties
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java
index dd96ab1..fe0a9fd 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java
@@ -16,11 +16,58 @@
  */
 package org.apache.camel.component.http;
 
+import org.apache.camel.Exchange;
+import org.apache.camel.spi.Metadata;
+import org.apache.http.HttpHeaders;
+
 public final class HttpConstants {
 
     public static final String CONTENT_TYPE_JAVA_SERIALIZED_OBJECT = "application/x-java-serialized-object";
     public static final String CONTENT_TYPE_WWW_FORM_URLENCODED = "application/x-www-form-urlencoded";
 
+    @Metadata(description = "The HTTP content encoding. Is set on both the IN and OUT message to\n" +
+                            "provide a content encoding, such as `gzip`.",
+              javaType = "String")
+    public static final String CONTENT_ENCODING = Exchange.CONTENT_ENCODING;
+    @Metadata(description = "The HTTP response code from the external server. Is 200 for OK.", javaType = "int")
+    public static final String HTTP_RESPONSE_CODE = Exchange.HTTP_RESPONSE_CODE;
+    @Metadata(description = "The HTTP response text from the external server.", javaType = "String")
+    public static final String HTTP_RESPONSE_TEXT = Exchange.HTTP_RESPONSE_TEXT;
+    @Metadata(label = "producer", description = "URI parameters. Will override existing URI parameters set directly on\n" +
+                                                "the endpoint.",
+              javaType = "String")
+    public static final String HTTP_QUERY = Exchange.HTTP_QUERY;
+    @Metadata(label = "producer", description = "The version of the http protocol used.", javaType = "String")
+    public static final String HTTP_PROTOCOL_VERSION = Exchange.HTTP_PROTOCOL_VERSION;
+    @Metadata(label = "producer", description = "The target host.", javaType = "String")
+    public static final String HTTP_HEADER_HOST = HttpHeaders.HOST;
+    @Metadata(label = "producer", description = "The rest http URI.", javaType = "String")
+    public static final String REST_HTTP_URI = Exchange.REST_HTTP_URI;
+    @Metadata(label = "producer", description = "URI to call. Will override existing URI set directly on the endpoint.\n" +
+                                                "This uri is the uri of the http server to call. Its not the same as the\n" +
+                                                "Camel endpoint uri, where you can configure endpoint options such as\n" +
+                                                "security etc. This header does not support that, its only the uri of the\n" +
+                                                "http server.",
+              javaType = "String")
+    public static final String HTTP_URI = Exchange.HTTP_URI;
+    @Metadata(label = "producer", description = "Request URI's path, the header will be used to build the request URI\n" +
+                                                "with the HTTP_URI.",
+              javaType = "String")
+    public static final String HTTP_PATH = Exchange.HTTP_PATH;
+    @Metadata(label = "producer", description = "The rest http query.", javaType = "String")
+    public static final String REST_HTTP_QUERY = Exchange.REST_HTTP_QUERY;
+    @Metadata(label = "producer", description = "The http raw query.", javaType = "String")
+    public static final String HTTP_RAW_QUERY = "CamelHttpRawQuery";
+    @Metadata(label = "producer", description = "The http method to use.",
+              javaType = "org.apache.camel.component.http.HttpMethods")
+    public static final String HTTP_METHOD = Exchange.HTTP_METHOD;
+    @Metadata(description = "The character encoding.", javaType = "String")
+    public static final String HTTP_CHARACTER_ENCODING = Exchange.HTTP_CHARACTER_ENCODING;
+    @Metadata(description = "The HTTP content type. Is set on both the IN and OUT message to provide\n" +
+                            "a content type, such as `text/html`.",
+              javaType = "String")
+    public static final String CONTENT_TYPE = Exchange.CONTENT_TYPE;
+
     private HttpConstants() {
     }
 }
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
index 587bfd3..1680e85 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
@@ -57,7 +57,7 @@ import org.slf4j.LoggerFactory;
  * Send requests to external HTTP servers using Apache HTTP Client 4.x.
  */
 @UriEndpoint(firstVersion = "2.3.0", scheme = "http,https", title = "HTTP,HTTPS", syntax = "http://httpUri",
-             producerOnly = true, category = { Category.HTTP }, lenientProperties = true)
+             producerOnly = true, category = { Category.HTTP }, lenientProperties = true, headersClass = HttpConstants.class)
 @Metadata(excludeProperties = "httpBinding,matchOnUriPrefix,chunked,disableStreamCache,transferException")
 @ManagedResource(description = "Managed HttpEndpoint")
 public class HttpEndpoint extends HttpCommonEndpoint {
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEntityConverter.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEntityConverter.java
index 923d8a6..651c680 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEntityConverter.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEntityConverter.java
@@ -62,7 +62,7 @@ public final class HttpEntityConverter {
     private static HttpEntity asHttpEntity(InputStream in, Exchange exchange) throws IOException {
         InputStreamEntity entity;
         if (exchange != null && !exchange.getProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.FALSE, Boolean.class)) {
-            String contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class);
+            String contentEncoding = exchange.getIn().getHeader(HttpConstants.CONTENT_ENCODING, String.class);
             InputStream stream = GZIPHelper.compressGzip(contentEncoding, in);
             entity = new InputStreamEntity(
                     stream, stream instanceof ByteArrayInputStream
@@ -71,7 +71,7 @@ public final class HttpEntityConverter {
             entity = new InputStreamEntity(in, -1);
         }
         if (exchange != null) {
-            String contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class);
+            String contentEncoding = exchange.getIn().getHeader(HttpConstants.CONTENT_ENCODING, String.class);
             if (contentEncoding != null) {
                 entity.setContentEncoding(contentEncoding);
             }
@@ -88,7 +88,7 @@ public final class HttpEntityConverter {
 
         String contentEncoding = null;
         if (exchange != null) {
-            contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class);
+            contentEncoding = exchange.getIn().getHeader(HttpConstants.CONTENT_ENCODING, String.class);
         }
 
         if (exchange != null && !exchange.getProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.FALSE, Boolean.class)) {
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
index d86f6d3..805bca0 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
@@ -108,9 +108,9 @@ public class HttpPollingConsumer extends PollingConsumerSupport {
                     message.setHeader(name, value);
                 }
             }
-            message.setHeader(Exchange.HTTP_RESPONSE_CODE, responseCode);
+            message.setHeader(HttpConstants.HTTP_RESPONSE_CODE, responseCode);
             if (response.getStatusLine() != null) {
-                message.setHeader(Exchange.HTTP_RESPONSE_TEXT, response.getStatusLine().getReasonPhrase());
+                message.setHeader(HttpConstants.HTTP_RESPONSE_TEXT, response.getStatusLine().getReasonPhrase());
             }
 
             return exchange;
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
index b5fb2b2..b889736 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
@@ -81,8 +81,6 @@ import org.apache.http.util.EntityUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.http.HttpHeaders.HOST;
-
 public class HttpProducer extends DefaultProducer {
 
     private static final Logger LOG = LoggerFactory.getLogger(HttpProducer.class);
@@ -155,7 +153,7 @@ public class HttpProducer extends DefaultProducer {
 
         if (getEndpoint().isBridgeEndpoint()) {
             exchange.setProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.TRUE);
-            String queryString = exchange.getIn().getHeader(Exchange.HTTP_QUERY, String.class);
+            String queryString = exchange.getIn().getHeader(HttpConstants.HTTP_QUERY, String.class);
             if (queryString != null) {
                 skipRequestHeaders = URISupport.parseQuery(queryString, false, true);
             }
@@ -165,7 +163,7 @@ public class HttpProducer extends DefaultProducer {
         HttpHost httpHost = createHost(httpRequest, exchange);
 
         Message in = exchange.getIn();
-        String httpProtocolVersion = in.getHeader(Exchange.HTTP_PROTOCOL_VERSION, String.class);
+        String httpProtocolVersion = in.getHeader(HttpConstants.HTTP_PROTOCOL_VERSION, String.class);
         if (httpProtocolVersion != null) {
             // set the HTTP protocol version
             int[] version = HttpHelper.parserHttpVersion(httpProtocolVersion);
@@ -250,15 +248,15 @@ public class HttpProducer extends DefaultProducer {
         }
 
         if (getEndpoint().getCustomHostHeader() != null) {
-            httpRequest.setHeader(HOST, getEndpoint().getCustomHostHeader());
+            httpRequest.setHeader(HttpConstants.HTTP_HEADER_HOST, getEndpoint().getCustomHostHeader());
         }
         //In reverse proxy applications it can be desirable for the downstream service to see the original Host header
         //if this option is set, and the exchange Host header is not null, we will set it's current value on the httpRequest
         if (getEndpoint().isPreserveHostHeader()) {
-            String hostHeader = exchange.getIn().getHeader("Host", String.class);
+            String hostHeader = exchange.getIn().getHeader(HttpConstants.HTTP_HEADER_HOST, String.class);
             if (hostHeader != null) {
                 //HttpClient 4 will check to see if the Host header is present, and use it if it is, see org.apache.http.protocol.RequestTargetHost in httpcore
-                httpRequest.setHeader(HOST, hostHeader);
+                httpRequest.setHeader(HttpConstants.HTTP_HEADER_HOST, hostHeader);
             }
         }
 
@@ -336,12 +334,12 @@ public class HttpProducer extends DefaultProducer {
 
         // optimize for 200 response code as the boxing is outside the cached integers
         if (responseCode == 200) {
-            answer.setHeader(Exchange.HTTP_RESPONSE_CODE, OK_RESPONSE_CODE);
+            answer.setHeader(HttpConstants.HTTP_RESPONSE_CODE, OK_RESPONSE_CODE);
         } else {
-            answer.setHeader(Exchange.HTTP_RESPONSE_CODE, responseCode);
+            answer.setHeader(HttpConstants.HTTP_RESPONSE_CODE, responseCode);
         }
         if (httpResponse.getStatusLine() != null) {
-            answer.setHeader(Exchange.HTTP_RESPONSE_TEXT, httpResponse.getStatusLine().getReasonPhrase());
+            answer.setHeader(HttpConstants.HTTP_RESPONSE_TEXT, httpResponse.getStatusLine().getReasonPhrase());
         }
         answer.setBody(response);
 
@@ -482,7 +480,7 @@ public class HttpProducer extends DefaultProducer {
             return null;
         }
 
-        Header header = httpResponse.getFirstHeader(Exchange.CONTENT_ENCODING);
+        Header header = httpResponse.getFirstHeader(HttpConstants.CONTENT_ENCODING);
         String contentEncoding = header != null ? header.getValue() : null;
 
         if (!exchange.getProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.FALSE, Boolean.class)) {
@@ -592,17 +590,17 @@ public class HttpProducer extends DefaultProducer {
         // these checks are checks that is done in HttpHelper.createURL and HttpHelper.createURI methods
         boolean create = false;
         Message in = exchange.getIn();
-        if (in.getHeader(Exchange.REST_HTTP_URI) != null) {
+        if (in.getHeader(HttpConstants.REST_HTTP_URI) != null) {
             create = true;
-        } else if (in.getHeader(Exchange.HTTP_URI) != null && !getEndpoint().isBridgeEndpoint()) {
+        } else if (in.getHeader(HttpConstants.HTTP_URI) != null && !getEndpoint().isBridgeEndpoint()) {
             create = true;
-        } else if (in.getHeader(Exchange.HTTP_PATH) != null) {
+        } else if (in.getHeader(HttpConstants.HTTP_PATH) != null) {
             create = true;
-        } else if (in.getHeader(Exchange.REST_HTTP_QUERY) != null) {
+        } else if (in.getHeader(HttpConstants.REST_HTTP_QUERY) != null) {
             create = true;
-        } else if (in.getHeader("CamelHttpRawQuery") != null) {
+        } else if (in.getHeader(HttpConstants.HTTP_RAW_QUERY) != null) {
             create = true;
-        } else if (in.getHeader(Exchange.HTTP_QUERY) != null) {
+        } else if (in.getHeader(HttpConstants.HTTP_QUERY) != null) {
             create = true;
         }
 
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpMethodHelper.java b/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpMethodHelper.java
index 474048d..87503b0 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpMethodHelper.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpMethodHelper.java
@@ -21,6 +21,7 @@ import java.net.URISyntaxException;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.RuntimeExchangeException;
+import org.apache.camel.component.http.HttpConstants;
 import org.apache.camel.component.http.HttpEndpoint;
 import org.apache.camel.component.http.HttpMethods;
 import org.apache.camel.util.UnsafeUriCharactersEncoder;
@@ -37,9 +38,9 @@ public final class HttpMethodHelper {
     public static HttpMethods createMethod(Exchange exchange, HttpEndpoint endpoint) throws URISyntaxException {
         // is a query string provided in the endpoint URI or in a header (header
         // overrules endpoint)
-        String queryString = exchange.getIn().getHeader(Exchange.HTTP_QUERY, String.class);
+        String queryString = exchange.getIn().getHeader(HttpConstants.HTTP_QUERY, String.class);
         // We need also check the HTTP_URI header query part
-        String uriString = exchange.getIn().getHeader(Exchange.HTTP_URI, String.class);
+        String uriString = exchange.getIn().getHeader(HttpConstants.HTTP_URI, String.class);
         if (uriString != null) {
             // resolve placeholders in uriString
             try {
@@ -63,7 +64,7 @@ public final class HttpMethodHelper {
             answer = HttpMethods.valueOf(endpoint.getHttpMethod().name());
         } else {
             // compute what method to use either GET or POST (header take precedence)
-            HttpMethods m = exchange.getIn().getHeader(Exchange.HTTP_METHOD, HttpMethods.class);
+            HttpMethods m = exchange.getIn().getHeader(HttpConstants.HTTP_METHOD, HttpMethods.class);
             if (m != null) {
                 // always use what end-user provides in a header
                 answer = m;