This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I have encountered an unusual behaviour with respect to file upload capability in Struts 1 application.
I have configured the max upload file size limit using the <controller> tag in struts configuration file as follows.
<controller maxFileSize="500K" />
Struts uses common fileupload library to handle file uploading functionality by default and if the file being uploaded exceeds the max file size, it sets a request-scopedattribute in the type of Boolean, under the name of the constant value : MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED.
But I experienced an unusual behaviour with large file upload. When uploading a larger file which is 300MB in size, my page hangs as the browser keeps sending the request data (obviously the file data stream) . But from server side, as soon as it determines that the file size is greater than the size limit, it immediately sets the earlier mentioned request-scoped variable and jumps out of the Action layer. So I feel that the request processing is not hung at server side, but browser keeps sending file data to the server even though the server has finished processing the request. Is there any solution for that? Am I missing something?
I'm using Struts 1.2.7 and commons file upload 1.0 combination. Also I re-tested the same functionality in latest Struts version that is 1.3.10 with common file uploads 1.2, but the behaviour is same.