abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From calav...@apache.org
Subject svn commit: r679065 - in /incubator/abdera/java/trunk/client/src: main/java/org/apache/abdera/protocol/client/util/MultimediaRelatedRequestEntity.java test/java/org/apache/abdera/test/client/util/MultipartRelatedRequestEntityTest.java
Date Wed, 23 Jul 2008 10:54:06 GMT
Author: calavera
Date: Wed Jul 23 03:54:06 2008
New Revision: 679065

URL: http://svn.apache.org/viewvc?rev=679065&view=rev
Log:
solved carriage return problems when the multipart file is created

Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MultimediaRelatedRequestEntity.java
    incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/util/MultipartRelatedRequestEntityTest.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MultimediaRelatedRequestEntity.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MultimediaRelatedRequestEntity.java?rev=679065&r1=679064&r2=679065&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MultimediaRelatedRequestEntity.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MultimediaRelatedRequestEntity.java
Wed Jul 23 03:54:06 2008
@@ -60,9 +60,9 @@
 	}
 	
 	private void writeEntry(DataOutputStream out) throws IOException {
-		out.writeBytes("content-type: " + MimeTypeHelper.getMimeType(entry) + "\r\n\r\n");
+		out.writeBytes("content-type: " + MimeTypeHelper.getMimeType(entry) + "\r\n\r\n");		
 		entry.writeTo(out);
-		out.writeBytes("\r\n" + "--" + boundary + "\r\n");
+		out.writeBytes("--" + boundary + "\r\n");
 	}
 	
 	private void writeInput(DataOutputStream out) throws IOException {
@@ -81,7 +81,7 @@
 		while ((end = input.read(buffer)) != -1) {
 			out.writeBytes(new BASE64Encoder().encode(buffer));
 		}	
-		out.writeBytes("\r\n" + "--" + boundary + "\r\n");
+		out.writeBytes("\r\n" + "--" + boundary + "--");
 	}
 
 	public long getContentLength() {		

Modified: incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/util/MultipartRelatedRequestEntityTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/util/MultipartRelatedRequestEntityTest.java?rev=679065&r1=679064&r2=679065&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/util/MultipartRelatedRequestEntityTest.java
(original)
+++ incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/util/MultipartRelatedRequestEntityTest.java
Wed Jul 23 03:54:06 2008
@@ -50,7 +50,8 @@
 		entry.setId("tag:apache.org,2008:234534344");
 		entry.setSummary("multipart test");
 		entry.setContent(new IRI("cid:234234@example.com"), "image/jpg");
-		RequestEntity request = new MultimediaRelatedRequestEntity(entry, this.getClass().getResourceAsStream("info.png"));
+		RequestEntity request = new MultimediaRelatedRequestEntity(entry, this.getClass().getResourceAsStream("info.png"),
+				"image/jpg", "asdfasdfasdf");
 		
 		StringWriter sw = new StringWriter();
 		WriterOutputStream os = new WriterOutputStream(sw);
@@ -58,6 +59,7 @@
 		
 		String multipart = sw.toString();
 		//System.out.println(sw.toString());
+		
 		assertTrue(multipart.contains("content-id: <234234@example.com>"));
 		assertTrue(multipart.contains("content-type: image/jpg"));
 	}



Mime
View raw message