You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Samuli Tuomola <sa...@ixonos.com> on 2012/02/10 15:16:35 UTC

[fileupload]

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


Re: [fileupload]

Posted by Samuli Tuomola <sa...@ixonos.com>.
Well damn, got a creeping suspicion right after hitting submit that I
should've checked the version control before posting and as you might
guess, this change was added already about a year ago (how about a
release?)

-Samuli

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