You cannot in Struts - because Struts does not receive a response object until your servlet container completes its processing.
However - most containers have controls over the size of the downloaded files, and for tomcat it is the maxPostSize parameter (default is 2 GB) - as far as I can tell, tomcat will count the number of bytes received, and then exit if this value is exceeded. Those. Tomcat will not continue to read past maxPostSize. Other containers will have similair configuration options. I have never used it, so I can no longer help.
If you have nested containers / services (e.g. tomcat sitting at the Apache Web Server), make sure you set it up correctly
source share