Hallo,
Unfortunately I have a problem, where I don't really know what the problem actually is. Like many others I have a problem with file upload. But it's not how to get a file upload work, it's more how to prevent a file upload, in case a MultipartException was thrown.
First, let me tell something about my setup;
In the spring context, I have the std. CommonsMultipartResolver:
In connection with that I am using the current Apache Commons Fileupload release (1.2.1). Anything behind that doesn't seem to be noteworthy, because my problem occurs before the controller is involved.Code:<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="maxUploadSize" value="5242880"/> </bean>
The thing is that the fileupload itself is working fine, but:
when a MaxUploadSizeExceededException is thrown, which is raised at last by the class' CommonsMultipartResolver parseRequest() method, the file upload is processed _anyway_!
So data is actually transfered at its full size, and after that the view is resolved and delegated back to the browser, although the exception is thrown immediately while the parseRequest() method executes its try block.
I watched this in the debugger and the Netbeans profiler(screenshot attached). During that I perceived, that transferring of the file data not startet yet. I also put the commons fileupload sources into my project to watch its behavior, with the result that during my watching time no stream was invoked. So after parseRequest() has thrown the Exception the debugger got to the exception resolver, my filters and stepped out. Having no more control, not sseing what happens now, the file transfer starts. (Could see that in the network tab of Win task manager). After the whole file is transfered the view appears in the browser. Even if I don't resolve the exception, you have to wait as well for the stack trace, given by the Tomcat server.
So, it seems to me apache fileupload is working correctly.
I think there is another thread working, processing the stream, but for god's sake I don't know how and why, searching and trying for almost one week until today.
Currently, I'm using Spring 2.5.6, because I guessed there was a problem when upgrading to Commons Fileupload 1.2.1, because of the following issue:
hyperTextTransferProtocol://issues.apache.org/jira/browse/FILEUPLOAD-145
The webserver I am using is Tomcat 6.0.18.
I really hope some of you have an idea what this could be about, kindly thanking in advance.
Good night.
/wthomas
Attachment:
Stack Trace:
Code:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size of 5242880 bytes exceeded; nested exception is org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (228445001) exceeds the configured maximum (5242880) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:583) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511) javax.servlet.http.HttpServlet.service(HttpServlet.java:637) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) de.....filters.IsInRoleFilter.doFilter(IsInRoleFilter.java:60) de.....filters.LastReqUrlFilter.doFilter(LastReqUrlFilter.java:41) de.....filters.LocaleFilter.doFilter(LocaleFilter.java:43) root cause org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size of 5242880 bytes exceeded; nested exception is org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (228445001) exceeds the configured maximum (5242880) org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:169) org.springframework.web.multipart.commons.CommonsMultipartResolver.resolveMultipart(CommonsMultipartResolver.java:149) org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:1012) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:853) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511) javax.servlet.http.HttpServlet.service(HttpServlet.java:637) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) de......filters.IsInRoleFilter.doFilter(IsInRoleFilter.java:60) de......filters.LastReqUrlFilter.doFilter(LastReqUrlFilter.java:41) de......filters.LocaleFilter.doFilter(LocaleFilter.java:43) root cause org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (228445001) exceeds the configured maximum (5242880) org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:914) org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331) org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:349) org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126) org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:165) org.springframework.web.multipart.commons.CommonsMultipartResolver.resolveMultipart(CommonsMultipartResolver.java:149) org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:1012) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:853) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511) javax.servlet.http.HttpServlet.service(HttpServlet.java:637) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) de.....filters.IsInRoleFilter.doFilter(IsInRoleFilter.java:60) de.....filters.LastReqUrlFilter.doFilter(LastReqUrlFilter.java:41) de.....filters.LocaleFilter.doFilter(LocaleFilter.java:43)



Reply With Quote
