[
https://issues.apache.org/jira/browse/FILEUPLOAD-200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thomas Polliard resolved FILEUPLOAD-200.
----------------------------------------
Resolution: Not A Problem
The issue was that sessions were not being passed between the ajp_proxy(http)
and the tomcat server. Once I resolved that issue, the system worked as
expected.
> During ServletFileUpload.parseRequest(factory) the servlet appears to read
> the data from the users file.
> --------------------------------------------------------------------------------------------------------
>
> Key: FILEUPLOAD-200
> URL: https://issues.apache.org/jira/browse/FILEUPLOAD-200
> Project: Commons FileUpload
> Issue Type: Bug
> Affects Versions: 1.2.2
> Environment: CentOS 5/Tomcat 7/JDK 1.7 (No Struts, etc...)
> Reporter: Thomas Polliard
>
> I have a very basic FileUpload Servlet I am working on. Using the following
> code:
> FileUploadListener listener = new FileUploadListener();
> context.log("DEBUG: Created listener");
> FileItemFactory factory = new DiskFileItemFactory();
> context.log("DEBUG: Created Disk Factory");
> ServletFileUpload uploader = new ServletFileUpload(factory);
> context.log("DEBUG: Created ServletFileUpload(factory)");
>
> request.getSession().setAttribute("ProgressListener",listener);
> context.log("DEBUG: Listner added to Session");
> List<FileItem> items = uploader.parseRequest(request);
> // GETS HERE ONLY AFTER WAITING FOR THE WHOLE FILE
> context.log("DEBUG: parsedRequest for FileItems");
> for (FileItem element : items) {
> if (!element.isFormField()) {
> context.log("DEBUG:" + element.getName());
> File fqfn = new File(f+"/"+element.getName());
> <snip>
> I try to upload a file (1G) the servlet appears to "upload" the file during
> the parseRequest() call. This appears to be not valid, as the List<FileItem>
> is pointless when trying to use the Listener to tell how much has been
> uploaded. The user has already had to wait for the parseRequest() to
> complete, and by then the listener says 0 bytes of Unknown Size.
> The file will write in the List<FileItem> loop. The reason I think this is a
> bug, is that I was expecting the parseRequest() to not "upload" the file but
> rather to return a list of the formfields as FileItems, and then during the
> FileItem loop and the subsequent write() call, the data would actually be
> written and therefore the Listener would function. Perhaps, I do not
> understand what the API is saying, or am missing some critical point.
> However, all the examples I see online from the Fileupload Site on ASF have
> the exact same behavior.
> Thanks for your time and work.
> Thomas
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira