Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 16275 invoked from network); 13 Sep 2005 02:18:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Sep 2005 02:18:20 -0000 Received: (qmail 81976 invoked by uid 500); 13 Sep 2005 02:18:15 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 81957 invoked by uid 500); 13 Sep 2005 02:18:15 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 81940 invoked by uid 99); 13 Sep 2005 02:18:14 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Sep 2005 19:18:14 -0700 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=HTML_40_50,HTML_MESSAGE,RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of michael.j.favata@gmail.com designates 64.233.162.201 as permitted sender) Received: from [64.233.162.201] (HELO zproxy.gmail.com) (64.233.162.201) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Sep 2005 19:18:26 -0700 Received: by zproxy.gmail.com with SMTP id x3so320730nzd for ; Mon, 12 Sep 2005 19:18:12 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; b=C+MJit26rwp3kea6xBtnQ6vwgfvf7boOICFiimRKDNPAZjZ6Y/rQm8PJZrus4IiS7GN+EDB9RIgSjqZdG3zaeprfe1F3afgB4EvO2Sb6BUMAxWrETI9gZ/HjSb0/LJJWCYJpAZKNLV94PcrFdWjMpZmP6uRaD3VzziHErDTWdDg= Received: by 10.36.74.10 with SMTP id w10mr177251nza; Mon, 12 Sep 2005 19:18:12 -0700 (PDT) Received: by 10.36.23.17 with HTTP; Mon, 12 Sep 2005 19:18:12 -0700 (PDT) Message-ID: <236dfbef05091219182b8c9141@mail.gmail.com> Date: Mon, 12 Sep 2005 22:18:12 -0400 From: Michael Favata Reply-To: michael.j.favata@gmail.com To: commons-user@jakarta.apache.org Subject: PortletFileUpload Returning Empty List Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_14938_22793596.1126577892537" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_14938_22793596.1126577892537 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I recently downloaded the nightly build (9/11/2005) of commons-fileupload= =20 and I am having a problem using PortletFileUpload. I am running Jetspeed 2= =20 on Tomcat 5.5.9. I am also using the MVCPortlet framework.=20 I am returned an empty list when I invoke the parseRequest method offered b= y=20 the PortletFileUpload class. After a few frustrating hours I downloaded the= =20 commons-fileupload source and noticed that a MalformedStreamException is=20 being buried in the skipPreamble method offered by the=20 org.apache.commons.fileupload.MultipartStream class: try { // Discard all data up to the delimiter. discardBodyData(); // Read boundary - if succeded, the stream contains an // encapsulation. return readBoundary(); } catch (MalformedStreamException e) { return false; } The encapsulated message in the exception is:=20 org.apache.commons.fileupload.MultipartStream$MalformedStreamException:Stre= am ended unexpectedly The JSP I am using to submit my html form is as follows: <%@ page contentType=3D"text/html; charset=3DUTF-8" %> <%@ page import=3D"java.util.List" %> <%@ page import=3D"java.util.ListIterator" %> <%@include file=3D"common_imports.jsp" %> <%=20 PortletURL o_upload_action_url =3D rRes.createActionURL(); o_upload_action_url.setParameter( "request_type", "UploadMedia" ); PortletURL o_go_back_render_url =3D rRes.createRenderURL(); o_go_back_render_url.setParameter("request_type", "ViewIndex"); %> <%@include file=3D"sys_message.jsp" %>

Upload Media


" method= =3D"POST"=20 enctype=3D"multipart/form-data"> Upload Single File: Use this upload option if you are uploading a=20 single file.


Share to Public

=20
[">Go Back]
An excerpt of the Java code I am using to extract the uploaded file: public String process(ActionRequest _o_request, ActionResponse _o_response,= =20 ActionConfig _o_config) throws PortletException, IOException { ... PortletFileUpload o_upload =3D new PortletFileUpload( new=20 DiskFileItemFactory() ); o_upload.setHeaderEncoding( PortletFileUpload.MULTIPART_FORM_DATA ); try { List l_items =3D o_upload.parseRequest( _o_request ); FileItem o_file_item =3D (FileItem) l_items.get( 0 ); } ... Inspecting the list returned from the parseRequest method using a debugger= =20 always yields an empty list. Perhaps there is a configuration entry in=20 either Tomcat or Jetspeed 2 that allows/disallows multipart file uploads? I= f=20 anyone has any ideas it would be greatly appreciated. Thank you in=20 advance!!! --=20 Michael J. Favata AIM: MjFavata ------=_Part_14938_22793596.1126577892537--