Author: ningjiang
Date: Mon Jun 28 10:37:51 2010
New Revision: 958535

URL: http://svn.apache.org/viewvc?rev=958535&view=rev
Log:
CAMEL-2870 camel-mail using the exchange charset name property as a fall back 
of the charset which used in content-type

Modified:
    
camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java

Modified: 
camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java?rev=958535&r1=958534&r2=958535&view=diff
==============================================================================
--- 
camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
 (original)
+++ 
camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
 Mon Jun 28 10:37:51 2010
@@ -136,6 +136,11 @@ public class MailBinding {
                 contentType = before.trim() + "; charset=" + charset;
             }
         }
+        
+        // set the charset if exchange has the charset name as fall back
+        if (contentType != null && !contentType.contains(";") && 
IOConverter.getCharsetName(exchange, false) != null) {
+            contentType = contentType.trim() + "; charset=" + 
IOConverter.getCharsetName(exchange, false);
+        }
 
         if (LOG.isTraceEnabled()) {
             LOG.trace("Determined Content-Type: " + contentType);
@@ -179,7 +184,12 @@ public class MailBinding {
                 }
             }
         }
-        return null;
+        
+        // Using the charset header of exchange as a fall back
+        return IOConverter.getCharsetName(exchange, false);
+        
+        
+        
     }
 
     protected String populateContentOnMimeMessage(MimeMessage part, 
MailConfiguration configuration, Exchange exchange)


Reply via email to