You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/10/09 10:15:54 UTC

[6/7] git commit: CAMEL-7886 Fixed the ContentType charset setting issue of camel-http4

CAMEL-7886 Fixed the ContentType charset setting issue of camel-http4


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

Branch: refs/heads/camel-2.13.x
Commit: 4ff0ee9f0d3779205c3f5839e7627f3161ae28ae
Parents: 3580582
Author: Willem Jiang <wi...@gmail.com>
Authored: Thu Oct 9 16:11:17 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Thu Oct 9 16:15:05 2014 +0800

----------------------------------------------------------------------
 .../java/org/apache/camel/component/http4/HttpProducer.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4ff0ee9f/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
index 2fb8380..d41dbe1 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
@@ -412,7 +412,12 @@ public class HttpProducer extends DefaultProducer {
                     //When ContentType.parse parse method parse "multipart/form-data;boundary=---------------------------j2radvtrk",
                     //it removes "boundary" from Content-Type; I have to use contentType.create method.
                     if (contentTypeString != null) {
-                        contentType = ContentType.create(contentTypeString);
+                        // using ContentType.parser for charset 
+                        if (contentTypeString.indexOf("charset") > 0) {
+                            contentType = ContentType.parse(contentTypeString);
+                        } else {
+                            contentType = ContentType.create(contentTypeString);
+                        }
                     }
                                         
                     if (contentTypeString != null && HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT.equals(contentTypeString)) {