1 42 package org.jfree.chart.servlet; 43 44 import java.io.File ; 45 import java.util.Iterator ; 46 import java.util.List ; 47 48 import javax.servlet.http.HttpSessionBindingEvent ; 49 import javax.servlet.http.HttpSessionBindingListener ; 50 51 57 public class ChartDeleter implements HttpSessionBindingListener { 58 59 60 private List chartNames = new java.util.ArrayList (); 61 62 65 public ChartDeleter() { 66 super(); 67 } 68 69 75 public void addChart(String filename) { 76 this.chartNames.add(filename); 77 } 78 79 87 public boolean isChartAvailable(String filename) { 88 return (this.chartNames.contains(filename)); 89 } 90 91 96 public void valueBound(HttpSessionBindingEvent event) { 97 return; 98 } 99 100 107 public void valueUnbound(HttpSessionBindingEvent event) { 108 109 Iterator iter = this.chartNames.listIterator(); 110 while (iter.hasNext()) { 111 String filename = (String ) iter.next(); 112 File file = new File ( 113 System.getProperty("java.io.tmpdir"), filename 114 ); 115 if (file.exists()) { 116 file.delete(); 117 } 118 } 119 return; 120 121 } 122 123 } 124 | Popular Tags |