commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samuli Tuomola <samuli.tuom...@ixonos.com>
Subject [fileupload]
Date Fri, 10 Feb 2012 14:16:35 GMT
Hi,
Recently a project required doing multipart upload using base64
content-transfer-encoding. After
spring's CommonsMultipartResolver failed to comply and after few hours
of digging into the sources it became apparent that 1) decoding
multiparts isn't implemented, 2) extending the resolver to do it isn't
possible because 3) commons-fileupload doesn't expose the multipart
headers. So, below is a two line patch that does it.

Also (while I realize the project wants to remain backwards compatible
to pre-generics days) Iterators are just PITA to work with, so it'd be
nice to see e.g. FileItemHeaders(Impl) replaced with a
crippled/commons-collection style CaseInsensitiveMap.

Regards,
-Samuli

diff -Naur src/java.old//org/apache/commons/fileupload/FileUploadBase.java
src/java/org/apache/commons/fileupload/FileUploadBase.java
--- src/java.old//org/apache/commons/fileupload/FileUploadBase.java
 2010-07-14 23:28:56.000000000 +0300
+++ src/java/org/apache/commons/fileupload/FileUploadBase.java
2012-02-06 19:38:34.574844115 +0200
@@ -1016,6 +1016,7 @@
                         currentItem = new FileItemStreamImpl(fileName,
                                 fieldName, headers.getHeader(CONTENT_TYPE),
                                 fileName == null, getContentLength(headers));
+                        currentItem.setHeaders(headers);
                         notifier.noteItem();
                         itemValid = true;
                         return true;
@@ -1027,6 +1028,7 @@
                                 currentFieldName,
                                 headers.getHeader(CONTENT_TYPE),
                                 false, getContentLength(headers));
+                        currentItem.setHeaders(headers);
                         notifier.noteItem();
                         itemValid = true;
                         return true;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message