commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ha Pham <>
Subject fileUpload causes getRequestDispatcher(url).forward hanging
Date Wed, 07 Jan 2009 20:42:49 GMT
Dear all,

I have a small snippet of code as below       

           DiskFileItemFactory  factory = new DiskFileItemFactory();
           ServletFileUpload upload = new ServletFileUpload(factory);    

            // maximum size that will be stored in memory
            // the location for saving data that is larger than getSizeThreshold()
            factory.setRepository(new File(System.getProperty("specFolderOnServer")));

            // maximum size before a FileUploadException will be thrown

            // Parse the request
            List<FileItem> items ;          
            try {
                items = upload.parseRequest(request);
            } catch (FileUploadException fue) {                       
               request.getRequestDispatcher(url).forward(request, response);

When I uploaded a file that exceeds limit size, the program hung at request.getRequestDispatcher(url).forward(request,

I did some research and found that it relates to the session locking somehow, but I could
not find a clear suggestion on how to have it resolved. Could anyone help me with this issue?

I currently have to remove the line  upload.setSizeMax and check filesize limit manually by
using method getSize in class FileItem. However, I have a feeling that it's more efficient
to set max file size in ServletFileUpload as the system may not need to copy/save the uploaded
file if its size exceeds the preset limit. Is this true?

Thank you,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message