incubator-wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r1292065 - in /incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart: InMultiPart.java OutMultiPart.java OutPart.java
Date Tue, 21 Feb 2012 22:41:03 GMT
Author: rfeng
Date: Tue Feb 21 22:41:02 2012
New Revision: 1292065

URL: http://svn.apache.org/viewvc?rev=1292065&view=rev
Log:
Fix the multipart format based on the http specs

Modified:
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/InMultiPart.java
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/OutMultiPart.java
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/OutPart.java

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/InMultiPart.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/InMultiPart.java?rev=1292065&r1=1292064&r2=1292065&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/InMultiPart.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/InMultiPart.java
Tue Feb 21 22:41:02 2012
@@ -48,7 +48,7 @@ import org.apache.wink.common.internal.p
  * }<br>
  */
 public class InMultiPart implements Iterator<InPart> {
-    public final static String SEP            = "\n"; //$NON-NLS-1$
+    public final static String SEP            = "\r\n"; //$NON-NLS-1$
     //private String             boundary       = "simple boundary";
     private MultiPartParser    MPParser;
     int                        index          = -1;

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/OutMultiPart.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/OutMultiPart.java?rev=1292065&r1=1292064&r2=1292065&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/OutMultiPart.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/OutMultiPart.java
Tue Feb 21 22:41:02 2012
@@ -36,7 +36,7 @@ import javax.ws.rs.ext.Providers;
 public abstract class OutMultiPart {
 
     private String             boundary = "simple boundary"; //$NON-NLS-1$
-    public final static String SEP      = "\n"; //$NON-NLS-1$
+    public final static String SEP      = "\r\n"; //$NON-NLS-1$
 
     /**
      * set the boundary to be used to separate between the different parts
@@ -69,13 +69,15 @@ public abstract class OutMultiPart {
      * @throws IOException
      */
     public void write(OutputStream os, Providers providers) throws IOException {
+
         Iterator<? extends OutPart> it = getIterator();
         while (it.hasNext()) {
             OutPart p = it.next();
-            os.write((SEP + "--" + boundary + SEP).getBytes()); //$NON-NLS-1$
+            os.write(("--" + getBoundary() + SEP).getBytes()); //$NON-NLS-1$
             p.writePart(os, providers);
+            os.write(SEP.getBytes());
         }
-        os.write((SEP + "--" + boundary + "--" + SEP).getBytes()); //$NON-NLS-1$ //$NON-NLS-2$
+        os.write(("--" + getBoundary() + "--" + SEP).getBytes()); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
 }

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/OutPart.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/OutPart.java?rev=1292065&r1=1292064&r2=1292065&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/OutPart.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/multipart/OutPart.java
Tue Feb 21 22:41:02 2012
@@ -119,9 +119,8 @@ public class OutPart {
         for (String name : getHeaders().keySet()) {
             List<String> values = getHeaders().get(name);
             for (String value : values) {
-                String header =
-                    new StringBuilder().append(name).append(": ").append(value) //$NON-NLS-1$
-                        .append(OutMultiPart.SEP).toString();
+                String header = new StringBuilder().append(name).append(": ").append(value)
//$NON-NLS-1$
+                    .append(OutMultiPart.SEP).toString();
                 os.write(header.getBytes());
             }
         }



Mime
View raw message