You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/09/29 17:48:07 UTC

svn commit: r819993 - in /cxf/branches/2.2.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java

Author: dkulp
Date: Tue Sep 29 15:48:06 2009
New Revision: 819993

URL: http://svn.apache.org/viewvc?rev=819993&view=rev
Log:
Merged revisions 819724 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r819724 | dkulp | 2009-09-28 16:39:01 -0400 (Mon, 28 Sep 2009) | 2 lines
  
  When pulling the root part out of a mime message, check if the charset
  is set in the parts mime headers and use it if it is
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java?rev=819993&r1=819992&r2=819993&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java (original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java Tue Sep 29 15:48:06 2009
@@ -34,6 +34,8 @@
 import javax.mail.MessagingException;
 import javax.mail.internet.InternetHeaders;
 
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Attachment;
@@ -120,7 +122,15 @@
             }
 
             try {
-                message.put(InternetHeaders.class.getName(), new InternetHeaders(stream));
+                InternetHeaders ih = new InternetHeaders(stream);
+                message.put(InternetHeaders.class.getName(), ih);
+                String val = ih.getHeader("Content-Type", "; ");
+                if (!StringUtils.isEmpty(val)) {
+                    String cs = HttpHeaderHelper.findCharset(val);
+                    if (!StringUtils.isEmpty(cs)) {
+                        message.put(Message.ENCODING, HttpHeaderHelper.mapCharset(cs));
+                    }
+                }
             } catch (MessagingException e) {
                 throw new RuntimeException(e);
             }