Reputation: 41
I'm trying to limit the maximum upload file size Jetty will accept. I've seen multiple reports that the following should work...
contextHandler.setMaxFormContentSize(xxx);
I notice that this does work for example on our login form, if I set it too a low value the submit is rejected. But for reasonable values (e.g. 5000) it doesn't fail large uploads (e.g. 9MB), perhaps because the upload is set to multi-part.
I could go with implementing our own upload servlet but would preffer to stick with the Jetty implementation. Any ideas on how to successfully limit upload size? I'd preffer an answer in code not a configuration file, we may need to change this based on remote user settings on startup.
Thanks.
Upvotes: 4
Views: 4221
Reputation: 13984
You might think about using the Apache Commons FileUpload instead of what comes with Jetty. You will get a very rich set of configuration options.
Upvotes: 1