I'm trying to use the inputFileUpload component from Tomahawk, but getting some problem when a file that is greater than defined by parameter uploadMaxFileSize.
When it's happening, the Tomahawk ExtensionsFilter only prints out the stack error on console:
"SizeLimitExceededException while uploading file."
And when this occurs, JSF goes from RESTORE_VIEW phase to RENDER_RESPONSE phase.
So I have no chance to handle this problem or even deal with this situation...
I don't want to use richfaces/primefaces/icefaces on my project. I'm limited to use JSF and Tomahawk only.
I already was trying to create my own component but I have no time to continue this subproject.
Obviously a very late reply, but since I was wondering what to do with this problem, I will put forward the solution that worked for me.
When in doubt, cheat.
Since the lifecycle is your problem because of the value in the web.xml, set it larger, to some obscene number if you really like, I used 10m.
This should allow any reasonalbe (but over) attempt to load an image to progress to your business logic.
Once there, inside your try/catch after you have checked for nulls etc, throw in a simple if statement that checks that the "file".getSize() is < your max value, if it isnt then "throw new SizeLimitExceededException("File to large", yourFileSize, maxSize)" and then catch that exception and deal with it how you wish, i logged it and sent them to an error page.
Of course if you arent interested in logging that exception you could probably just return "failure" and redirect to your error page without having thrown a new exception.
You know it is dark times when the trees riot. I think this tiny ad is their leader:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop