axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r356074 - in /webservices/axis2/trunk/java/modules/xml: src/org/apache/axis2/om/impl/MIMEOutputUtils.java test/org/apache/axis2/om/MIMEOutputUtilsTest.java
Date Mon, 12 Dec 2005 00:27:02 GMT
Author: dims
Date: Sun Dec 11 16:26:58 2005
New Revision: 356074

URL: http://svn.apache.org/viewcvs?rev=356074&view=rev
Log:
CRLF bytes depends on the character encoding

Modified:
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java
    webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/MIMEOutputUtilsTest.java

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java?rev=356074&r1=356073&r2=356074&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java
(original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java
Sun Dec 11 16:26:58 2005
@@ -30,7 +30,7 @@
 
 public class MIMEOutputUtils {
 
-    private static byte[] CRLF = {13, 10};
+    private static String CRLF = "\r\n";
     private Log log = LogFactory.getLog(getClass());
 
     public static void complete(OutputStream outStream,
@@ -39,7 +39,7 @@
         try {
             startWritingMime(outStream, boundary);
 
-            javax.activation.DataHandler dh = new javax.activation.DataHandler(bufferedSoapOutStream.toString(),
+            javax.activation.DataHandler dh = new javax.activation.DataHandler(bufferedSoapOutStream,
                     "text/xml");
             MimeBodyPart rootMimeBodyPart = new MimeBodyPart();
             rootMimeBodyPart.setDataHandler(dh);
@@ -50,13 +50,13 @@
             rootMimeBodyPart.addHeader("content-transfer-encoding", "binary");
             rootMimeBodyPart.addHeader("content-id","<"+contentId+">");
 
-            writeBodyPart(outStream, rootMimeBodyPart, boundary);
+            writeBodyPart(outStream, rootMimeBodyPart, boundary, charSetEncoding);
 
             Iterator binaryNodeIterator = binaryNodeList.iterator();
             while (binaryNodeIterator.hasNext()) {
                 OMText binaryNode = (OMText) binaryNodeIterator.next();
                 writeBodyPart(outStream, createMimeBodyPart(binaryNode),
-                        boundary);
+                        boundary, charSetEncoding);
             }
             finishWritingMime(outStream);
         } catch (IOException e) {
@@ -105,11 +105,13 @@
      * @throws MessagingException
      */
     public static void writeBodyPart(OutputStream outStream,
-                                     MimeBodyPart part, String boundary) throws IOException,
+                                     MimeBodyPart part, 
+                                     String boundary,
+                                     String encoding) throws IOException,
             MessagingException {
-        outStream.write(CRLF);
+        outStream.write(CRLF.getBytes(encoding));
         part.writeTo(outStream);
-        outStream.write(CRLF);
+        outStream.write(CRLF.getBytes(encoding));
         writeMimeBoundary(outStream, boundary);
     }
 

Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/MIMEOutputUtilsTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/MIMEOutputUtilsTest.java?rev=356074&r1=356073&r2=356074&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/MIMEOutputUtilsTest.java
(original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/MIMEOutputUtilsTest.java
Sun Dec 11 16:26:58 2005
@@ -65,7 +65,7 @@
 
         MIMEOutputUtils.startWritingMime(outStream, boundary);
         MimeBodyPart part1 = MIMEOutputUtils.createMimeBodyPart(textData);
-        MIMEOutputUtils.writeBodyPart(outStream, part1, boundary);
+        MIMEOutputUtils.writeBodyPart(outStream, part1, boundary, "UTF-8");
         MimeBodyPart part2 = MIMEOutputUtils.createMimeBodyPart(text);
         MIMEOutputUtils.writeBodyPart(outStream, part2, boundary);
         MIMEOutputUtils.finishWritingMime(outStream);



Mime
View raw message