users@javaserverfaces.java.net

Multipart form submit problem

From: <anton.grinenko_at_ardas.dp.ua>
Date: Fri, 23 Sep 2011 12:38:25 +0000 (GMT)

Greetings,

I have a problem with uploading of big files.
I have simple html form on client side.
On server side a have a servlet that processes multipart requests with
commons-fileupload library. I set max request size :
                DiskFileItemFactory factory = new
DiskFileItemFactory();
                ServletFileUpload upload = new
ServletFileUpload(factory);
                upload.setSizeMax(maxRequestSize);
                upload.setFileSizeMax(maxRequestSize);
So, if the file is too big
                upload.parseRequest(request);
throws an exception.

The problem is:
When uploaded file is too big servlet throws SizeLimitExceededException
and finishes his work very quickly but on client side form submit
continues and I have to wait several minutes until it ends. Why this is
happened? And how can I cancel client form submit when servlet throws
an exception?

I use JBoss 4.2.3 and commons-fileupload-1.2.2.

Thanks in advance