| java.lang.Object org.jfree.chart.servlet.ServletUtilities
ServletUtilities | public class ServletUtilities (Code) | | Utility class used for servlet related JFreeChart operations.
|
Method Summary | |
protected static void | createTempDir() Creates the temporary directory if it does not exist. | public static String | getTempFilePrefix() Returns the prefix for the temporary file names generated by this class. | public static String | getTempOneTimeFilePrefix() Returns the prefix for "one time" temporary file names generated by
this class. | protected static void | registerChartForDeletion(File tempFile, HttpSession session) Adds a
ChartDeleter object to the session object with the name
JFreeChart_Deleter if there is not already one bound to the
session and adds the filename to the list of charts to be deleted. | public static String | saveChartAsJPEG(JFreeChart chart, int width, int height, HttpSession session) Saves the chart as a JPEG format file in the temporary directory.
SPECIAL NOTE: Please avoid using JPEG as an image format for charts,
it is a "lossy" format that introduces visible distortions in the
resulting image - use PNG instead. | public static String | saveChartAsJPEG(JFreeChart chart, int width, int height, ChartRenderingInfo info, HttpSession session) Saves the chart as a JPEG format file in the temporary directory and
populates the ChartRenderingInfo object which can be used
to generate an HTML image map.
SPECIAL NOTE: Please avoid using JPEG as an image format for charts,
it is a "lossy" format that introduces visible distortions in the
resulting image - use PNG instead. | public static String | saveChartAsPNG(JFreeChart chart, int width, int height, HttpSession session) Saves the chart as a PNG format file in the temporary directory.
Parameters: chart - the JFreeChart to be saved. Parameters: width - the width of the chart. Parameters: height - the height of the chart. Parameters: session - the HttpSession of the client (if null , thetemporary file is marked as "one-time" and deleted by the DisplayChart servlet right after it isstreamed to the client). | public static String | saveChartAsPNG(JFreeChart chart, int width, int height, ChartRenderingInfo info, HttpSession session) Saves the chart as a PNG format file in the temporary directory and
populates the
ChartRenderingInfo object which can be used to
generate an HTML image map.
Parameters: chart - the chart to be saved (null not permitted). Parameters: width - the width of the chart. Parameters: height - the height of the chart. Parameters: info - the ChartRenderingInfo object to be populated (null permitted). Parameters: session - the HttpSession of the client (if null , thetemporary file is marked as "one-time" and deleted by the DisplayChart servlet right after it isstreamed to the client). | public static String | searchReplace(String inputString, String searchString, String replaceString) Perform a search/replace operation on a String
There are String methods to do this since (JDK 1.4)
Parameters: inputString - the String to have the search/replace operation. Parameters: searchString - the search String. Parameters: replaceString - the replace String. | public static void | sendTempFile(String filename, HttpServletResponse response) Binary streams the specified file in the temporary directory to the
HTTP response in 1KB chunks. | public static void | sendTempFile(File file, HttpServletResponse response) Binary streams the specified file to the HTTP response in 1KB chunks. | public static void | sendTempFile(File file, HttpServletResponse response, String mimeType) Binary streams the specified file to the HTTP response in 1KB chunks. | public static void | setTempFilePrefix(String prefix) Sets the prefix for the temporary file names generated by this class. | public static void | setTempOneTimeFilePrefix(String prefix) Sets the prefix for the "one time" temporary file names generated by
this class. |
createTempDir | protected static void createTempDir()(Code) | | Creates the temporary directory if it does not exist. Throws a
RuntimeException if the temporary directory is
null . Uses the system property java.io.tmpdir
as the temporary directory. This sounds like a strange thing to do but
my temporary directory was not created on my default Tomcat 4.0.3
installation. Could save some questions on the forum if it is created
when not present.
|
getTempFilePrefix | public static String getTempFilePrefix()(Code) | | Returns the prefix for the temporary file names generated by this class.
The prefix (never null ). |
getTempOneTimeFilePrefix | public static String getTempOneTimeFilePrefix()(Code) | | Returns the prefix for "one time" temporary file names generated by
this class.
The prefix. |
registerChartForDeletion | protected static void registerChartForDeletion(File tempFile, HttpSession session)(Code) | | Adds a
ChartDeleter object to the session object with the name
JFreeChart_Deleter if there is not already one bound to the
session and adds the filename to the list of charts to be deleted.
Parameters: tempFile - the file to be deleted. Parameters: session - the HTTP session of the client. |
saveChartAsJPEG | public static String saveChartAsJPEG(JFreeChart chart, int width, int height, HttpSession session) throws IOException(Code) | | Saves the chart as a JPEG format file in the temporary directory.
SPECIAL NOTE: Please avoid using JPEG as an image format for charts,
it is a "lossy" format that introduces visible distortions in the
resulting image - use PNG instead. In addition, note that JPEG output
is supported by JFreeChart only for JRE 1.4.2 or later.
Parameters: chart - the JFreeChart to be saved. Parameters: width - the width of the chart. Parameters: height - the height of the chart. Parameters: session - the HttpSession of the client (if null , thetemporary file is marked as "one-time" and deleted by the DisplayChart servlet right after it isstreamed to the client). The filename of the chart saved in the temporary directory. throws: IOException - if there is a problem saving the file. |
saveChartAsJPEG | public static String saveChartAsJPEG(JFreeChart chart, int width, int height, ChartRenderingInfo info, HttpSession session) throws IOException(Code) | | Saves the chart as a JPEG format file in the temporary directory and
populates the ChartRenderingInfo object which can be used
to generate an HTML image map.
SPECIAL NOTE: Please avoid using JPEG as an image format for charts,
it is a "lossy" format that introduces visible distortions in the
resulting image - use PNG instead. In addition, note that JPEG output
is supported by JFreeChart only for JRE 1.4.2 or later.
Parameters: chart - the chart to be saved (null not permitted). Parameters: width - the width of the chart Parameters: height - the height of the chart Parameters: info - the ChartRenderingInfo object to be populated Parameters: session - the HttpSession of the client (if null , thetemporary file is marked as "one-time" and deleted by the DisplayChart servlet right after it isstreamed to the client). The filename of the chart saved in the temporary directory throws: IOException - if there is a problem saving the file. |
saveChartAsPNG | public static String saveChartAsPNG(JFreeChart chart, int width, int height, HttpSession session) throws IOException(Code) | | Saves the chart as a PNG format file in the temporary directory.
Parameters: chart - the JFreeChart to be saved. Parameters: width - the width of the chart. Parameters: height - the height of the chart. Parameters: session - the HttpSession of the client (if null , thetemporary file is marked as "one-time" and deleted by the DisplayChart servlet right after it isstreamed to the client). The filename of the chart saved in the temporary directory. throws: IOException - if there is a problem saving the file. |
saveChartAsPNG | public static String saveChartAsPNG(JFreeChart chart, int width, int height, ChartRenderingInfo info, HttpSession session) throws IOException(Code) | | Saves the chart as a PNG format file in the temporary directory and
populates the
ChartRenderingInfo object which can be used to
generate an HTML image map.
Parameters: chart - the chart to be saved (null not permitted). Parameters: width - the width of the chart. Parameters: height - the height of the chart. Parameters: info - the ChartRenderingInfo object to be populated (null permitted). Parameters: session - the HttpSession of the client (if null , thetemporary file is marked as "one-time" and deleted by the DisplayChart servlet right after it isstreamed to the client). The filename of the chart saved in the temporary directory. throws: IOException - if there is a problem saving the file. |
searchReplace | public static String searchReplace(String inputString, String searchString, String replaceString)(Code) | | Perform a search/replace operation on a String
There are String methods to do this since (JDK 1.4)
Parameters: inputString - the String to have the search/replace operation. Parameters: searchString - the search String. Parameters: replaceString - the replace String. The String with the replacements made. |
sendTempFile | public static void sendTempFile(String filename, HttpServletResponse response) throws IOException(Code) | | Binary streams the specified file in the temporary directory to the
HTTP response in 1KB chunks.
Parameters: filename - the name of the file in the temporary directory. Parameters: response - the HTTP response object. throws: IOException - if there is an I/O problem. |
sendTempFile | public static void sendTempFile(File file, HttpServletResponse response) throws IOException(Code) | | Binary streams the specified file to the HTTP response in 1KB chunks.
Parameters: file - the file to be streamed. Parameters: response - the HTTP response object. throws: IOException - if there is an I/O problem. |
sendTempFile | public static void sendTempFile(File file, HttpServletResponse response, String mimeType) throws IOException(Code) | | Binary streams the specified file to the HTTP response in 1KB chunks.
Parameters: file - the file to be streamed. Parameters: response - the HTTP response object. Parameters: mimeType - the mime type of the file, null allowed. throws: IOException - if there is an I/O problem. |
setTempFilePrefix | public static void setTempFilePrefix(String prefix)(Code) | | Sets the prefix for the temporary file names generated by this class.
Parameters: prefix - the prefix (null not permitted). |
setTempOneTimeFilePrefix | public static void setTempOneTimeFilePrefix(String prefix)(Code) | | Sets the prefix for the "one time" temporary file names generated by
this class.
Parameters: prefix - the prefix (null not permitted). |
|
|