cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r747454 - in /cxf/trunk/rt: core/src/main/java/org/apache/cxf/attachment/ transports/http/src/main/java/org/apache/cxf/transport/http/
Date Tue, 24 Feb 2009 17:41:20 GMT
Author: dkulp
Date: Tue Feb 24 17:41:19 2009
New Revision: 747454

URL: http://svn.apache.org/viewvc?rev=747454&view=rev
Log:
[CXF-2062] Fix mime content-type header

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java?rev=747454&r1=747453&r2=747454&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java Tue
Feb 24 17:41:19 2009
@@ -71,16 +71,14 @@
             st.append("\"").append(bodyCt.substring(pos, bodyCt.length() - 1));
             bodyCt = st.toString();
         }        
-        String enc = (String) message.get(Message.ENCODING);
-        if (enc == null) {
-            enc = "UTF-8";
-        }
         
         // Set transport mime type
         StringBuilder ct = new StringBuilder();
         ct.append("multipart/related; ");
         if (xop) {
             ct.append("type=\"application/xop+xml\"; ");
+        } else {
+            ct.append("type=\"").append(bodyCt).append("\"; ");
         }
         
         ct.append("boundary=\"")
@@ -95,6 +93,7 @@
         
         message.put(Message.CONTENT_TYPE, ct.toString());
 
+        
         // 2. write headers
         out = message.getContent(OutputStream.class);
         encoding = (String) message.get(Message.ENCODING);
@@ -108,7 +107,7 @@
         
         StringBuilder mimeBodyCt = new StringBuilder();
         mimeBodyCt.append("application/xop+xml; charset=")
-            .append(enc)
+            .append(encoding)
             .append("; type=\"")
             .append(bodyCt)
             .append("\";");

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=747454&r1=747453&r2=747454&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Tue Feb 24 17:41:19 2009
@@ -222,7 +222,8 @@
         
         if (null != ct 
             && null != enc
-            && ct.indexOf("charset=") == -1) {
+            && ct.indexOf("charset=") == -1
+            && !ct.toLowerCase().contains("multipart/related")) {
             ct = ct + "; charset=" + enc;
         }
 

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=747454&r1=747453&r2=747454&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Tue Feb 24 17:41:19 2009
@@ -870,7 +870,9 @@
         String enc = (String) message.get(Message.ENCODING);
         
         if (null != ct) {
-            if (enc != null && ct.indexOf("charset=") == -1) {
+            if (enc != null 
+                && ct.indexOf("charset=") == -1
+                && !ct.toLowerCase().contains("multipart/related")) {
                 ct = ct + "; charset=" + enc;
             }
         } else if (enc != null) {



Mime
View raw message