You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by bob <sa...@gmail.com> on 2008/03/05 20:33:06 UTC
[FileUpload] Safe to continue parsing after SizeLimitExceededException
Hi all,
In FileUploadBase I can set the sizeMax or fileSizeMax property. When
calling the method FileUploadBase#parseRequest(..) an exception will
be thrown if the sizeMax or fileSizeMax is exceeded. This means the
request is not parsed at all, so form fields are not available.
I have two related questions:
#1 Will I encounter any problems if I override the
FileUploadBase#parseRequest(..) method and continue parsing the
request after an exception is raised? Meaning I continue iterating
and extracting the remaining request items.
#2 Are form fields parsed before the actual files are parsed? Meaning
if an exception is raised during my custom FileUploadBase#parseRequest
method can I just grab all the FileItem instances already created at
that point and just exit the method, knowing all form fields are
available. Or should I continue parsing the request and do the check
fileItem#isFormField?
kind regards
bob
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [FileUpload] Safe to continue parsing after SizeLimitExceededException
Posted by bob <sa...@gmail.com>.
Having looked into this I think I can answer my own questions now. For
the benefit of others I will answer them here ;-)
bob wrote:
> I have two related questions:
>
> #1 Will I encounter any problems if I override the
> FileUploadBase#parseRequest(..) method and continue parsing the request
> after an exception is raised? Meaning I continue iterating and
> extracting the remaining request items.
Yes you will have problems. Since FileUpload v1.2.1 the
request#inputStream is closed when a FileSizeLimitExceededException is
thrown. FileItemIterator can't parse any more items once the stream is
closed.
>
> #2 Are form fields parsed before the actual files are parsed? Meaning if
> an exception is raised during my custom FileUploadBase#parseRequest
> method can I just grab all the FileItem instances already created at
> that point and just exit the method, knowing all form fields are
> available. Or should I continue parsing the request and do the check
> fileItem#isFormField?
>
No the order of the items are as they appear on the HTML Form.
kind regards
bob
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org