I'm working on a online document management system where users can download multiple documents as a single ZIP file. These files can get to large to handle completly in memory so in that case we use a temp file. That temp file is then send to the client using Http11NioProtocol with org.apache.tomcat.sendfile set to the temp file. The problem is after tranferring the file to the clients browser the server is stuck with a temp file.
Ofc. it's possible to use deleteAfterExit or some sort of tempFileManager but what I'm looking for is a way to register a handler function when the file is completly transferred or have some sort of callback function that can be used to clean up the temp files?