The CrystalImageCleaner object is needed to ensure
that temporary files used by the viewer are removed periodically. Adding a
properly configured CrystalImageCleaner object to JSP pages that use the viewer
helps improve the performance of your web application.
Note: The following line of code is
necessary in your JSP pages in order to ensure that the CrystalImageCleaner
object is available.
<%@ page import="com.crystaldecisions.report.web.viewer.CrystalImageCleaner" %>
Example 1
This sample method creates a CrystalImageCleaner
object that scans for image files once every minute, but only deletes files
that are at least 2 minutes old. Proper tweaking of these settings is necessary
in order to ensure optimal performance of your application, as the optimal
values for these settings are highly dependent on viewer usage and application
design characteristics.
<%!
public void jspInit(){
CrystalImageCleaner.start(getServletContext(), 60000, 12000);
}
%>
Example 2
This sample method stops the CrystalImageCleaner
object once the JSP page is removed from service.
<%!
public void jspDestroy(){
CrystalImageCleaner.stop(getServletContext());
}
%>