cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r773693 - in /cxf/trunk/rt/core/src/main/java/org/apache/cxf: attachment/AttachmentSerializer.java interceptor/AttachmentOutInterceptor.java
Date Mon, 11 May 2009 20:57:47 GMT
Author: dkulp
Date: Mon May 11 20:57:47 2009
New Revision: 773693

URL: http://svn.apache.org/viewvc?rev=773693&view=rev
Log:
If message has attachments, force into mime mode
If attachment doesn't have an ID, be OK with that.  Don't NPE.

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.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=773693&r1=773692&r2=773693&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 Mon
May 11 20:57:47 2009
@@ -124,13 +124,16 @@
 
         writer.write("Content-Transfer-Encoding: binary\r\n");
 
-        writer.write("Content-ID: <");
-        if (attachmentId.charAt(0) == '<'
-            && attachmentId.charAt(attachmentId.length() - 1) == '>') {
-            attachmentId = attachmentId.substring(1, attachmentId.length() - 1);
+        if (attachmentId != null) {
+            writer.write("Content-ID: <");
+            if (attachmentId.charAt(0) == '<'
+                && attachmentId.charAt(attachmentId.length() - 1) == '>') {
+                attachmentId = attachmentId.substring(1, attachmentId.length() - 1);
+            }
+            writer.write(URLDecoder.decode(attachmentId, "UTF-8"));
+            writer.write(">\r\n");
         }
-        writer.write(URLDecoder.decode(attachmentId, "UTF-8"));
-        writer.write(">\r\n\r\n");
+        writer.write("\r\n");
     }
 
     /**

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java?rev=773693&r1=773692&r2=773693&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java
Mon May 11 20:57:47 2009
@@ -47,7 +47,8 @@
         // by declaring the Object.
         Object prop = message.getContextualProperty(org.apache.cxf.message.Message.MTOM_ENABLED);

         boolean mtomEnabled = MessageUtils.isTrue(prop);
-        boolean writeAtts = MessageUtils.isTrue(message.getContextualProperty(WRITE_ATTACHMENTS));
+        boolean writeAtts = MessageUtils.isTrue(message.getContextualProperty(WRITE_ATTACHMENTS))
+            || (message.getAttachments() != null && !message.getAttachments().isEmpty());
         
         if (!mtomEnabled && !writeAtts) {
             return;



Mime
View raw message