Is this a bug? When a MultipartHttpServletRequest parses the values using MultipartParser it puts the Inline Parts into a Vector, but when parsing FileParts it just puts them into the "parts" hashtable. The problem with this is when a Request has multiple FileParts named the same, the parsed parts for the FilePart will always be the value of the last parsed FilePart. Using the example HTML below, if you attached different files to All.foo for each row, the MultipartParser would only have 1 value for All.foo ( the value from the second row ) instead of a vector. Let me know what you think, I can create a patch.
Example HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns:page="http://pace2020.com/appbox/page/2.0" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> </head> <body> <form method="post" name="appboxForm" action="/estimating/object/Customer/list?tab=0" enctype="multipart/form-data"> <table id="All"> <tbody> <tr> <td> <input name="All.primaryKey" type="hidden" value="FOO'BAR"/> </td> <td> <input name="All.foo" class="filefield" type="file" id="d1508e107"/> </td> </tr> <tr> <td> <input name="All.primaryKey" type="hidden" value="HOUSE"/> </td> <td> <input name="All.foo" class="filefield" type="file" id="d1508e144"/> </td> </tr> </tbody> </table> <input name="appbox-continuation-id" type="hidden" value="1a0b71687548296a197026662a6366591a211b00"/> <input type="hidden" name="appbox_currentTab" id="appbox_currentTab" value="0"/> </form> </body> </html> http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apach e/cocoon/servlet/multipart/MultipartParser.java?revision=638212&view=markup private void parseFilePart(TokenStream in, Hashtable headers) IOException, MultipartException At the bottom of the method String name = (String)headers.get("name"); if (oversized) { this.parts.put(name, new RejectedPart(headers, length, this.contentLength, this.maxUploadSize)); } else if (file == null) { byte[] bytes = ((ByteArrayOutputStream) out).toByteArray(); this.parts.put(name, new PartInMemory(headers, bytes)); } else { this.parts.put(name, new PartOnDisk(headers, file)); } Thanks in Advance, Jerry DuVal Pace Systems Group, Inc. 800.624.5999 www.Pace2020.com
