My application is running on jboss AS7+RestEasy, currently I am handling file size limit in my APi as
@POST
@GZIP
@RequestFilter
@Produces("application/json")
@Consumes("multipart/form-data")
@Path("/demo/test")
public String uploadTest(
@MultipartForm UPFile uploadFileFile,
) {
if (uploadFileFile.getFileSize() > 10*10*1024) {
//error..
}
}
Where I get fileSize as @FormParm, this works for me.
Issue is that uploadTest() this api gets called after file is uploaded to jboss container, and then it check for file size this takes unnecessarily server resources (Say client uploads 1GB data this data will be uploaded to server) I am looking for something that rejects files once they exceed size of 10MB.