开发者

Limit upload size in embedded Jetty

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜