Author: dkulp Date: Tue Sep 29 16:28:21 2009 New Revision: 820018 URL: http://svn.apache.org/viewvc?rev=820018&view=rev Log: Merged revisions 819993 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes
................ r819993 | dkulp | 2009-09-29 11:48:06 -0400 (Tue, 29 Sep 2009) | 10 lines 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.1.x-fixes/ (props changed) cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java Propchange: cxf/branches/2.1.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java?rev=820018&r1=820017&r2=820018&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java (original) +++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java Tue Sep 29 16:28:21 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); }
