I have a break controller method that receives the multipart file parameter, I need to limit its restriction on file size. I tried different options, but it does not work for me. I am using Apache Tomcat 8. I am calling the rest method using a windows service.
Following the definition of the class and method:
@Controller
public class MyClass{
...
}
@RequestMapping(value = "/path/method/param1/{param1}/param2/{param2}/",
method = RequestMethod.POST)
public ResponseEntity<String> method(DTO dto, @RequestParam("file") MultipartFile multipartFile){
...
}
Proven solutions:
<multipart-config>
<max-file-size>52428800</max-file-size>
<max-request-size>52428800</max-request-size>
<file-size-threshold>0<</file-size-threshold>
</multipart-config>
Adding the maxPostSize and maxSwallowSize properties to the node connector in the server.xml file
Adding size parameters to a .properties file
Adding @MultipartConfig annotation in the controller class
Any idea or suggestions?
source
share