Vadim Gritsenko wrote:
Sylvain Wallez wrote:
Hi all,
Uploads in Cocoon are handled at the servlet level, including a check
of the maximum upload size which raises an exception. This exception
is a major pain because it gives no chance to the application to warn
the user that she exceeded the allowed limit. All we get is an ugly
servlet engine-generated error page.
Rather than throwing an exception, the multipart parser could store
in the request a special implementation of the Part interface,
"InvalidPart" that allows the application to know about it and react
Or 'RejectedPart' - which is closer to truth.
Definitely.
accordingly. For example, the CForms upload widget could show a
validation error in such occasions.
All methods of the Part interface (getInputStream, getName, etc)
would of course throw an exception in InvalidPart, but that exception
would have a chance to be handled cleanly by a <map:handle-errors>
It will be better if only getInputStream() throws exception. Methods
like getSize(), getUploadName() can be (extremely!) useful for
creatining meaningful error messages:
Unfortunately, your file FooBar.doc is 101Kb large, which exceeds
allowed upload limit by 1Kb.
Oh yes, very cool!
WDYT?
Violent +1!
Ouch, that hurts :-P
Sylvain
--
Sylvain Wallez Anyware Technologies
http://people.apache.org/~sylvain http://www.anyware-tech.com
Apache Software Foundation Member Research & Technology Director