Hi Bob, Thanks so much for your response. I wasn't aware of the Context.getFileItem(String name) method. This is a great help.
I am using the FileField control, but my application is AJAX based so I am using a hidden iframe as the target of the form to upload the file and avoid a browser refresh. I had created a custom servlet to parse the multipart request, but really missed having the ClickServlet available for generating a click-based response. Best regards, Nick. -----Original Message----- From: Bob Schellink [mailto:[email protected]] Sent: Sunday, August 21, 2011 11:44 PM To: [email protected] Subject: Re: CommonsFileUploadService.parseRequest(request) returns zero items Hi Nick, Indeed, Click parses the request using Commons FileUpload by default so that the uploaded FileItem is available to the FileField control. You could also access the FileItem through the Context.getFileItem(String name); Any reason you don't want to use the FileField control? You could replace Click's default FileUpload to do nothing by default allowing you to manually parse the request. Hope this helps. Bob On 2011/08/22 07:53 AM, Nicholas Dierauf wrote: > > Hello, > > > > I am trying to use Click to upload a file from a form. I was successful in > doing this when I created my own "vanilla" servlet to process the upload > using Apache Commons FileUpload package. But when I try to process the file > upload in a Page class I am finding that: > > List<FileItem> items = service.parseRequest(request); > > returns a list of size zero. > > > > I observed that the first question/answer in the commons FileUpload FAQ > (http://commons.apache.org/fileupload/faq.html) is this: > > Q: Why is parseRequest() returning no items? > > A: This most commonly happens when the request has already been parsed, or > processed in some other way. Since the input stream has aleady been consumed > by that earlier process, it is no longer available for parsing by Commons > FileUpload. > > > > Does anybody know if the ClickServlet is consuming the multipart request > input stream before constructing the Page object? Note, I am also using > Apache Shiro for authc/autha and have configured a ShiroFilter which may also > be my culprit, but I'm not seeing any evidence during debug. > > > > Any help with this is appreciated. > > Nick.
