camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject camel git commit: CAMEL-9833: Add mapHttpMessage option to allow to turn off mapping by default
Date Thu, 07 Apr 2016 14:43:02 GMT
Repository: camel
Updated Branches:
  refs/heads/master fd08031bb -> 0b78c8318


CAMEL-9833: Add mapHttpMessage option to allow to turn off mapping by default


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0b78c831
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0b78c831
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0b78c831

Branch: refs/heads/master
Commit: 0b78c8318ac77c7c491000905560da28c448c03f
Parents: fd08031
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Thu Apr 7 16:41:58 2016 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Thu Apr 7 16:41:58 2016 +0200

----------------------------------------------------------------------
 .../camel/http/common/DefaultHttpBinding.java   | 35 +++++++++++---------
 1 file changed, 19 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0b78c831/components/camel-http-common/src/main/java/org/apache/camel/http/common/DefaultHttpBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-http-common/src/main/java/org/apache/camel/http/common/DefaultHttpBinding.java
b/components/camel-http-common/src/main/java/org/apache/camel/http/common/DefaultHttpBinding.java
index 6f5a97f..c3a7080 100644
--- a/components/camel-http-common/src/main/java/org/apache/camel/http/common/DefaultHttpBinding.java
+++ b/components/camel-http-common/src/main/java/org/apache/camel/http/common/DefaultHttpBinding.java
@@ -27,6 +27,7 @@ import java.net.URLDecoder;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
@@ -104,23 +105,25 @@ public class DefaultHttpBinding implements HttpBinding {
             message.getBody();
         }
         // populate the headers from the request if mapHttpHeaders is true
-        Map<String, Object> headers = message.getHeaders();  
+        Map<String, Object> headers = new HashMap<String, Object>();  
         if (mapHttpMessageHeaders) {
-            //apply the headerFilterStrategy
-            Enumeration<?> names = request.getHeaderNames();
-            while (names.hasMoreElements()) {
-                String name = (String)names.nextElement();
-                String value = request.getHeader(name);
-                // use http helper to extract parameter value as it may contain multiple
values
-                Object extracted = HttpHelper.extractHttpParameterValue(value);
-                // mapping the content-type
-                if (name.toLowerCase().equals("content-type")) {
-                    name = Exchange.CONTENT_TYPE;
-                }
-                if (headerFilterStrategy != null
-                    && !headerFilterStrategy.applyFilterToExternalHeaders(name, extracted,
message.getExchange())) {
-                    HttpHelper.appendHeader(headers, name, extracted);
-                }
+        	headers = message.getHeaders();
+        }
+        
+        //apply the headerFilterStrategy
+        Enumeration<?> names = request.getHeaderNames();
+        while (names.hasMoreElements()) {
+            String name = (String)names.nextElement();
+            String value = request.getHeader(name);
+            // use http helper to extract parameter value as it may contain multiple values
+            Object extracted = HttpHelper.extractHttpParameterValue(value);
+            // mapping the content-type
+            if (name.toLowerCase().equals("content-type")) {
+                name = Exchange.CONTENT_TYPE;
+            }
+            if (headerFilterStrategy != null
+                && !headerFilterStrategy.applyFilterToExternalHeaders(name, extracted,
message.getExchange())) {
+                HttpHelper.appendHeader(headers, name, extracted);
             }
         }
                 


Mime
View raw message