Bonjour à tous,
Je génère mes rapports au format html. Pour les graphiques j'utilise donc les lignes de codes suivantes qui permettent de stocker le graphique dans une image :
Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
//Configure the emitter to handle actions and images
HTMLEmitterConfig emitterConfig = new HTMLEmitterConfig();
emitterConfig.setActionHandler( new HTMLActionHandler());
HTMLServerImageHandler imageHandler = new HTMLServerImageHandler();
emitterConfig.setImageHandler(imageHandler);
config.getEmitterConfigs().put("html", emitterConfig);
//Set Render context to handle url and image locataions
HTMLRenderContext renderContext = new HTMLRenderContext();
//Set the Base URL for all actions
renderContext.setBaseURL(contextPath);
//Tell the Engine to prepend all images with this URL - Note this requires using the HTMLServerImageHandler
renderContext.setBaseImageURL(contextPath + "/images" );
//Tell the Engine where to write the images to
renderContext.setImageDirectory(imageDirectory);
HashMap contextMap = new HashMap();
contextMap.put(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext);
task.setAppContext(contextMap ); |
Lorsque que j'appelle cette fonction de génération de mon rapport il stocke donc des fichiers temporaires dans mon imageDirectory. Ma question est donc la suivante : Comment fait-on pour supprimer ces fichiers temporaires une fois le rapport généré et affiché ?
Merci pour vos réponses !