You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/02/26 09:00:05 UTC

[camel] branch master updated (1e5e46b -> 265d61f)

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

davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 1e5e46b  CAMEL-16171 - Add uri-endpoint-override options to all AWS2 components - AWS2-CW component
     new 11f44b9  camel-http - optiomize: if cookie management is disabled then producer should not clear as this waste resources.
     new 265d61f  camel-http - Optimize to reuse HttpHost when using default uri

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/camel/catalog/docs/http-component.adoc  |  2 +-
 .../org/apache/camel/component/http/http.json      |  2 +-
 .../org/apache/camel/component/http/https.json     |  2 +-
 .../camel-http/src/main/docs/http-component.adoc   |  2 +-
 .../apache/camel/component/http/HttpEndpoint.java  |  6 ++-
 .../apache/camel/component/http/HttpProducer.java  | 46 ++++++++++++++++------
 .../endpoint/dsl/HttpEndpointBuilderFactory.java   |  8 +++-
 .../modules/ROOT/pages/http-component.adoc         |  2 +-
 8 files changed, 48 insertions(+), 22 deletions(-)


[camel] 01/02: camel-http - optiomize: if cookie management is disabled then producer should not clear as this waste resources.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 11f44b94b26989ca30dead6c376dfb796e37d19e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Feb 26 09:17:00 2021 +0100

    camel-http - optiomize: if cookie management is disabled then producer should not clear as this waste resources.
---
 .../resources/org/apache/camel/catalog/docs/http-component.adoc   | 2 +-
 .../generated/resources/org/apache/camel/component/http/http.json | 2 +-
 .../resources/org/apache/camel/component/http/https.json          | 2 +-
 components/camel-http/src/main/docs/http-component.adoc           | 2 +-
 .../main/java/org/apache/camel/component/http/HttpEndpoint.java   | 6 ++++--
 .../main/java/org/apache/camel/component/http/HttpProducer.java   | 3 ++-
 .../camel/builder/endpoint/dsl/HttpEndpointBuilderFactory.java    | 8 ++++++--
 docs/components/modules/ROOT/pages/http-component.adoc            | 2 +-
 8 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/http-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/http-component.adoc
index e048a42..1362da24 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/http-component.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/http-component.adoc
@@ -140,7 +140,7 @@ with the following path and query parameters:
 | *httpBinding* (common) | To use a custom HttpBinding to control the mapping between Camel message and HttpClient. |  | HttpBinding
 | *bridgeEndpoint* (producer) | If the option is true, HttpProducer will ignore the Exchange.HTTP_URI header, and use the endpoint's URI for request. You may also set the option throwExceptionOnFailure to be false to let the HttpProducer send all the fault response back. | false | boolean
 | *chunked* (producer) | If this option is false the Servlet will disable the HTTP streaming and set the content-length header on the response | true | boolean
-| *clearExpiredCookies* (producer) | Whether to clear expired cookies before sending the HTTP request. This ensures the cookies store does not keep growing by adding new cookies which is newer removed when they are expired. | true | boolean
+| *clearExpiredCookies* (producer) | Whether to clear expired cookies before sending the HTTP request. This ensures the cookies store does not keep growing by adding new cookies which is newer removed when they are expired. If the component has disabled cookie management then this option is disabled too. | true | boolean
 | *connectionClose* (producer) | Specifies whether a Connection Close header must be added to HTTP Request. By default connectionClose is false. | false | boolean
 | *copyHeaders* (producer) | If this option is true then IN exchange headers will be copied to OUT exchange headers according to copy strategy. Setting this to false, allows to only include the headers from the HTTP response (not propagating IN headers). | true | boolean
 | *customHostHeader* (producer) | To use custom host header for producer. When not set in query will be ignored. When set will override host header derived from url. |  | String
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 3009616..4bec6b9 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
@@ -69,7 +69,7 @@
     "httpBinding": { "kind": "parameter", "displayName": "Http Binding", "group": "common (advanced)", "label": "common,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.http.common.HttpBinding", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom HttpBinding to control the mapping between Camel message and HttpClient." },
     "bridgeEndpoint": { "kind": "parameter", "displayName": "Bridge Endpoint", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the option is true, HttpProducer will ignore the Exchange.HTTP_URI header, and use the endpoint's URI for request. You may also set the option throwExceptionOnFailure to be false to let the HttpProducer send al [...]
     "chunked": { "kind": "parameter", "displayName": "Chunked", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "If this option is false the Servlet will disable the HTTP streaming and set the content-length header on the response" },
-    "clearExpiredCookies": { "kind": "parameter", "displayName": "Clear Expired Cookies", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to clear expired cookies before sending the HTTP request. This ensures the cookies store does not keep growing by adding new cookies which is newer removed when they are expired." },
+    "clearExpiredCookies": { "kind": "parameter", "displayName": "Clear Expired Cookies", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to clear expired cookies before sending the HTTP request. This ensures the cookies store does not keep growing by adding new cookies which is newer removed when they are expired. If the component [...]
     "connectionClose": { "kind": "parameter", "displayName": "Connection Close", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Specifies whether a Connection Close header must be added to HTTP Request. By default connectionClose is false." },
     "copyHeaders": { "kind": "parameter", "displayName": "Copy Headers", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "If this option is true then IN exchange headers will be copied to OUT exchange headers according to copy strategy. Setting this to false, allows to only include the headers from the HTTP response (not propagating IN head [...]
     "customHostHeader": { "kind": "parameter", "displayName": "Custom Host Header", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom host header for producer. When not set in query will be ignored. When set will override host header derived from url." },
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 aedd1ea..2cb4e0c 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
@@ -69,7 +69,7 @@
     "httpBinding": { "kind": "parameter", "displayName": "Http Binding", "group": "common (advanced)", "label": "common,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.http.common.HttpBinding", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom HttpBinding to control the mapping between Camel message and HttpClient." },
     "bridgeEndpoint": { "kind": "parameter", "displayName": "Bridge Endpoint", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the option is true, HttpProducer will ignore the Exchange.HTTP_URI header, and use the endpoint's URI for request. You may also set the option throwExceptionOnFailure to be false to let the HttpProducer send al [...]
     "chunked": { "kind": "parameter", "displayName": "Chunked", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "If this option is false the Servlet will disable the HTTP streaming and set the content-length header on the response" },
-    "clearExpiredCookies": { "kind": "parameter", "displayName": "Clear Expired Cookies", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to clear expired cookies before sending the HTTP request. This ensures the cookies store does not keep growing by adding new cookies which is newer removed when they are expired." },
+    "clearExpiredCookies": { "kind": "parameter", "displayName": "Clear Expired Cookies", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to clear expired cookies before sending the HTTP request. This ensures the cookies store does not keep growing by adding new cookies which is newer removed when they are expired. If the component [...]
     "connectionClose": { "kind": "parameter", "displayName": "Connection Close", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Specifies whether a Connection Close header must be added to HTTP Request. By default connectionClose is false." },
     "copyHeaders": { "kind": "parameter", "displayName": "Copy Headers", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "If this option is true then IN exchange headers will be copied to OUT exchange headers according to copy strategy. Setting this to false, allows to only include the headers from the HTTP response (not propagating IN head [...]
     "customHostHeader": { "kind": "parameter", "displayName": "Custom Host Header", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use custom host header for producer. When not set in query will be ignored. When set will override host header derived from url." },
diff --git a/components/camel-http/src/main/docs/http-component.adoc b/components/camel-http/src/main/docs/http-component.adoc
index e048a42..1362da24 100644
--- a/components/camel-http/src/main/docs/http-component.adoc
+++ b/components/camel-http/src/main/docs/http-component.adoc
@@ -140,7 +140,7 @@ with the following path and query parameters:
 | *httpBinding* (common) | To use a custom HttpBinding to control the mapping between Camel message and HttpClient. |  | HttpBinding
 | *bridgeEndpoint* (producer) | If the option is true, HttpProducer will ignore the Exchange.HTTP_URI header, and use the endpoint's URI for request. You may also set the option throwExceptionOnFailure to be false to let the HttpProducer send all the fault response back. | false | boolean
 | *chunked* (producer) | If this option is false the Servlet will disable the HTTP streaming and set the content-length header on the response | true | boolean
-| *clearExpiredCookies* (producer) | Whether to clear expired cookies before sending the HTTP request. This ensures the cookies store does not keep growing by adding new cookies which is newer removed when they are expired. | true | boolean
+| *clearExpiredCookies* (producer) | Whether to clear expired cookies before sending the HTTP request. This ensures the cookies store does not keep growing by adding new cookies which is newer removed when they are expired. If the component has disabled cookie management then this option is disabled too. | true | boolean
 | *connectionClose* (producer) | Specifies whether a Connection Close header must be added to HTTP Request. By default connectionClose is false. | false | boolean
 | *copyHeaders* (producer) | If this option is true then IN exchange headers will be copied to OUT exchange headers according to copy strategy. Setting this to false, allows to only include the headers from the HTTP response (not propagating IN headers). | true | boolean
 | *customHostHeader* (producer) | To use custom host header for producer. When not set in query will be ignored. When set will override host header derived from url. |  | String
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 6ccea0f..f37bfea 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
@@ -116,7 +116,8 @@ public class HttpEndpoint extends HttpCommonEndpoint {
     private CookieStore cookieStore = new BasicCookieStore();
     @UriParam(label = "producer", defaultValue = "true",
               description = "Whether to clear expired cookies before sending the HTTP request."
-                            + " This ensures the cookies store does not keep growing by adding new cookies which is newer removed when they are expired.")
+                            + " This ensures the cookies store does not keep growing by adding new cookies which is newer removed when they are expired."
+                            + " If the component has disabled cookie management then this option is disabled too.")
     private boolean clearExpiredCookies = true;
     @UriParam(label = "producer,security",
               description = "If this option is true, camel-http sends preemptive basic authentication to the server.")
@@ -334,7 +335,8 @@ public class HttpEndpoint extends HttpCommonEndpoint {
 
     /**
      * Whether to clear expired cookies before sending the HTTP request. This ensures the cookies store does not keep
-     * growing by adding new cookies which is newer removed when they are expired.
+     * growing by adding new cookies which is newer removed when they are expired. If the component has disabled cookie
+     * management then this option is disabled too.
      */
     public void setClearExpiredCookies(boolean clearExpiredCookies) {
         this.clearExpiredCookies = clearExpiredCookies;
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 7e53412..728943d 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
@@ -133,7 +133,8 @@ public class HttpProducer extends DefaultProducer {
 
     @Override
     public void process(Exchange exchange) throws Exception {
-        if (getEndpoint().isClearExpiredCookies() && !getEndpoint().isBridgeEndpoint()) {
+        boolean cookies = !getEndpoint().getComponent().isCookieManagementDisabled();
+        if (cookies && getEndpoint().isClearExpiredCookies() && !getEndpoint().isBridgeEndpoint()) {
             // create the cookies before the invocation
             getEndpoint().getCookieStore().clearExpired(new Date());
         }
diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HttpEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HttpEndpointBuilderFactory.java
index f5989f1..0b71ae4 100644
--- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HttpEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HttpEndpointBuilderFactory.java
@@ -210,7 +210,9 @@ public interface HttpEndpointBuilderFactory {
         /**
          * Whether to clear expired cookies before sending the HTTP request.
          * This ensures the cookies store does not keep growing by adding new
-         * cookies which is newer removed when they are expired.
+         * cookies which is newer removed when they are expired. If the
+         * component has disabled cookie management then this option is disabled
+         * too.
          * 
          * The option is a: &lt;code&gt;boolean&lt;/code&gt; type.
          * 
@@ -228,7 +230,9 @@ public interface HttpEndpointBuilderFactory {
         /**
          * Whether to clear expired cookies before sending the HTTP request.
          * This ensures the cookies store does not keep growing by adding new
-         * cookies which is newer removed when they are expired.
+         * cookies which is newer removed when they are expired. If the
+         * component has disabled cookie management then this option is disabled
+         * too.
          * 
          * The option will be converted to a &lt;code&gt;boolean&lt;/code&gt;
          * type.
diff --git a/docs/components/modules/ROOT/pages/http-component.adoc b/docs/components/modules/ROOT/pages/http-component.adoc
index a939887..74481d3 100644
--- a/docs/components/modules/ROOT/pages/http-component.adoc
+++ b/docs/components/modules/ROOT/pages/http-component.adoc
@@ -142,7 +142,7 @@ with the following path and query parameters:
 | *httpBinding* (common) | To use a custom HttpBinding to control the mapping between Camel message and HttpClient. |  | HttpBinding
 | *bridgeEndpoint* (producer) | If the option is true, HttpProducer will ignore the Exchange.HTTP_URI header, and use the endpoint's URI for request. You may also set the option throwExceptionOnFailure to be false to let the HttpProducer send all the fault response back. | false | boolean
 | *chunked* (producer) | If this option is false the Servlet will disable the HTTP streaming and set the content-length header on the response | true | boolean
-| *clearExpiredCookies* (producer) | Whether to clear expired cookies before sending the HTTP request. This ensures the cookies store does not keep growing by adding new cookies which is newer removed when they are expired. | true | boolean
+| *clearExpiredCookies* (producer) | Whether to clear expired cookies before sending the HTTP request. This ensures the cookies store does not keep growing by adding new cookies which is newer removed when they are expired. If the component has disabled cookie management then this option is disabled too. | true | boolean
 | *connectionClose* (producer) | Specifies whether a Connection Close header must be added to HTTP Request. By default connectionClose is false. | false | boolean
 | *copyHeaders* (producer) | If this option is true then IN exchange headers will be copied to OUT exchange headers according to copy strategy. Setting this to false, allows to only include the headers from the HTTP response (not propagating IN headers). | true | boolean
 | *customHostHeader* (producer) | To use custom host header for producer. When not set in query will be ignored. When set will override host header derived from url. |  | String


[camel] 02/02: camel-http - Optimize to reuse HttpHost when using default uri

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 265d61fa502a83141fd7e669afc8813606cc9661
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Feb 26 09:59:15 2021 +0100

    camel-http - Optimize to reuse HttpHost when using default uri
---
 .../apache/camel/component/http/HttpProducer.java  | 43 ++++++++++++++++------
 1 file changed, 31 insertions(+), 12 deletions(-)

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 728943d..d20df05 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
@@ -59,12 +59,14 @@ import org.apache.camel.util.UnsafeUriCharactersEncoder;
 import org.apache.http.Header;
 import org.apache.http.HeaderIterator;
 import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
 import org.apache.http.client.methods.HttpRequestBase;
 import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.client.utils.URIUtils;
 import org.apache.http.entity.ByteArrayEntity;
 import org.apache.http.entity.ContentType;
 import org.apache.http.entity.FileEntity;
@@ -95,6 +97,8 @@ public class HttpProducer extends DefaultProducer {
     private int maxOkRange;
     private String defaultUrl;
     private URI defaultUri;
+    private URI defaultRelativeUri;
+    private HttpHost defaultHttpHost;
 
     public HttpProducer(HttpEndpoint endpoint) {
         super(endpoint);
@@ -129,6 +133,7 @@ public class HttpProducer extends DefaultProducer {
         }
         defaultUri = uri;
         defaultUrl = uri.toASCIIString();
+        defaultHttpHost = URIUtils.extractHost(uri);
     }
 
     @Override
@@ -152,6 +157,8 @@ public class HttpProducer extends DefaultProducer {
         }
 
         HttpRequestBase httpRequest = createMethod(exchange);
+        HttpHost httpHost = createHost(httpRequest, exchange);
+
         Message in = exchange.getIn();
         String httpProtocolVersion = in.getHeader(Exchange.HTTP_PROTOCOL_VERSION, String.class);
         if (httpProtocolVersion != null) {
@@ -260,7 +267,7 @@ public class HttpProducer extends DefaultProducer {
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Executing http {} method: {}", httpRequest.getMethod(), httpRequest.getURI());
             }
-            httpResponse = executeMethod(httpRequest);
+            httpResponse = executeMethod(httpHost, httpRequest);
             int responseCode = httpResponse.getStatusLine().getStatusCode();
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Http responseCode: {}", responseCode);
@@ -418,11 +425,12 @@ public class HttpProducer extends DefaultProducer {
     /**
      * Strategy when executing the method (calling the remote server).
      *
-     * @param  httpRequest the http Request to execute
+     * @param  httpHost    the http host to call
+     * @param  httpRequest the http request to execute
      * @return             the response
      * @throws IOException can be thrown
      */
-    protected HttpResponse executeMethod(HttpUriRequest httpRequest) throws IOException {
+    protected HttpResponse executeMethod(HttpHost httpHost, HttpUriRequest httpRequest) throws IOException {
         HttpContext localContext = new BasicHttpContext();
         if (getEndpoint().isAuthenticationPreemptive()) {
             BasicScheme basicAuth = new BasicScheme();
@@ -431,7 +439,7 @@ public class HttpProducer extends DefaultProducer {
         if (httpContext != null) {
             localContext = new BasicHttpContext(httpContext);
         }
-        return httpClient.execute(httpRequest, localContext);
+        return httpClient.execute(httpHost, httpRequest, localContext);
     }
 
     /**
@@ -543,6 +551,17 @@ public class HttpProducer extends DefaultProducer {
     }
 
     /**
+     * Creates the HttpHost to use to call the remote server
+     */
+    protected HttpHost createHost(HttpRequestBase httpRequest, Exchange exchange) throws Exception {
+        if (httpRequest.getURI() == defaultUri) {
+            return defaultHttpHost;
+        } else {
+            return URIUtils.extractHost(httpRequest.getURI());
+        }
+    }
+
+    /**
      * Creates the HttpMethod to use to call the remote server, either its GET or POST.
      *
      * @param  exchange           the exchange
@@ -561,17 +580,18 @@ public class HttpProducer extends DefaultProducer {
         // a new url that is dynamic based on header values
         // these checks are checks that is done in HttpHelper.createURL and HttpHelper.createURI methods
         boolean create = false;
-        if (exchange.getIn().getHeader("CamelRestHttpUri") != null) {
+        Message in = exchange.getIn();
+        if (in.getHeader("CamelRestHttpUri") != null) {
             create = true;
-        } else if (exchange.getIn().getHeader("CamelHttpUri") != null && !getEndpoint().isBridgeEndpoint()) {
+        } else if (in.getHeader("CamelHttpUri") != null && !getEndpoint().isBridgeEndpoint()) {
             create = true;
-        } else if (exchange.getIn().getHeader("CamelHttpPath") != null) {
+        } else if (in.getHeader("CamelHttpPath") != null) {
             create = true;
-        } else if (exchange.getIn().getHeader("CamelRestHttpQuery") != null) {
+        } else if (in.getHeader("CamelRestHttpQuery") != null) {
             create = true;
-        } else if (exchange.getIn().getHeader("CamelHttpRawQuery") != null) {
+        } else if (in.getHeader("CamelHttpRawQuery") != null) {
             create = true;
-        } else if (exchange.getIn().getHeader("CamelHttpQuery") != null) {
+        } else if (in.getHeader("CamelHttpQuery") != null) {
             create = true;
         }
 
@@ -610,8 +630,7 @@ public class HttpProducer extends DefaultProducer {
         // there must be a host on the method
         if (method.getURI().getScheme() == null || method.getURI().getHost() == null) {
             throw new IllegalArgumentException(
-                    "Invalid url: " + url
-                                               + ". If you are forwarding/bridging http endpoints, then enable the bridgeEndpoint option on the endpoint: "
+                    "Invalid url: " + url + ". If you are forwarding/bridging http endpoints, then enable the bridgeEndpoint option on the endpoint: "
                                                + getEndpoint());
         }