How would I go about deleting the images jfreechart creates in tomcat's temp directory? I assumed they'd be cleaned out by Tomcat, but this is not the case.
I saw some mentions to a ChartDeleter class, but I am unsure how to use it, or if it's suppose to be used to do this.
Thanks.
Deleting temporary images
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
My understanding of the ServletUtilities class is that it looks for an existing ChartDeleter in the current session, automatically add a new ChartDeleter if none is found, registers the temporary file with the ChartDeleter, and when the session expires the ChartDeleter removes all temporary files that have been registered with it. But I didn't write these classes and don't use them so I could be wrong.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


In the 1.0pre2 version there is also another possibility. Setting the session to null
will cause that the DisplayChart servlet will delete the file after the first request.
Code: Select all
filename = ServletUtilities.saveChartAsPNG(chart, 950, 600, cri, null);