I\'m currently implementing functionality for uploading files using jersey rest. I would like to set a maximum allowed file size which to me seems like a pretty common requi
If you're using tomcat you can set the the size threshold at which the file will be written to the disk to a sensible value for your machine.
e.g. if the servlet is in web.xml
Upload Servlet
YourServletName
10485760
10240
524288
or using annotations:
@MultipartConfig(
maxFileSize=10485760, // 10Mb max
fileSizeThreshold=524288, //512 Kb before buffering to disk
maxRequestSize=10240 // 10Kb of meta data
location=/tmp // with permission to write, default uses tomcat tmp
)
With reference to HttpRequest maximum allowable size in tomcat?