I have this exact same issue. The way that I got around it was to rework the Upload service to add an error message to the parameters parser if the file is too big, rather than just throwing out the exception. Then, in my code I look for the FileItem in the parameter parser using the field name where I expect to find it, and if I find a String instead then I consider this a failed field validation and re-render the original multipart form with the error message.

-Brian

On Friday, January 30, 2004, at 06:28 AM, Peter Riegersperger wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Jan 30, 2004, at 15:00, Chris Joelly wrote:


Hello again!

i want to use the UploadService but have problems when i upload files
bigger than configured in TurbineResources.properties.

so i have read the java api of the uploadservice classes and found a
statement that uploads can be handled outomatically by parameterparser
or by an action. and that the turbine property
services.UploadService.automatic should be set to false ...

do i have to handle the file uploads with this stuff to avoid
TurbineExceptions?

not necessarily. i have the same problem, and just found a way to make this "work".
this is a dirty work around that fits my purposes, because i neither have time nor the incentive to switch away from the turbine upload service (which works fine, apart from this issue). ymww.


as pretext, i assumed that
"There is a switch somwhere in the properties where one can say if the
service should handle this exception which is default or the app handles the
exception, but this doesn't work properly. "
http://www.mail-archive.com/[EMAIL PROTECTED]/ msg13973.html


is correct. i didn't try.

what i made (this very minute):

before the exception is thrown, the isAuthorized(RunData data) method of your action class is executed.
in this method, i put a marker in the session:
data.getSession().setAttribute("action", "post");


the exception will lead to the the screen template set to error.vm (or whatever you have in your config file).
the $processingException and $stacktrace references will be empty, so if you test for something like:


#if ($data.getSession().getAttribute("action").equals("post") && !$processingException)

than there is a chance that the file was too big.

hope that helps, and if somebody comes up with a better solution, i'd be gracious.

peter riegersperger
- -
subnet
platform for media art and experimental technologies
muehlbacherhofweg 5 - 5020 salzburg / austria - www.subnet.at - +43/662/842897
- -
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)


iD8DBQFAGmoHIMP39JYOy9IRAsGeAJ9wGoFd3i70s9JOMOPxp8GF4l3cQwCgg1Xf
uPW7sXIMSfYXA8LVjn1a0b0=
=xe71
-----END PGP SIGNATURE-----


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to