Documentation of 'org.jfree.chart.servlet.ServletUtilities' Java class
ServletUtilities
org.jfree.chart.servlet

Class ServletUtilities



  • public class ServletUtilities
    extends java.lang.Object
    Utility class used for servlet related JFreeChart operations.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ServletUtilities() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String getTempFilePrefix()
      Returns the prefix for the temporary file names generated by this class.
      static java.lang.String getTempOneTimeFilePrefix()
      Returns the prefix for "one time" temporary file names generated by this class.
      static java.lang.String saveChartAsJPEG(JFreeChart chart, int width, int height, ChartRenderingInfo info, javax.servlet.http.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.
      static java.lang.String saveChartAsJPEG(JFreeChart chart, int width, int height, javax.servlet.http.HttpSession session)
      Saves the chart as a JPEG format file in the temporary directory.
      static java.lang.String saveChartAsPNG(JFreeChart chart, int width, int height, ChartRenderingInfo info, javax.servlet.http.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.
      static java.lang.String saveChartAsPNG(JFreeChart chart, int width, int height, javax.servlet.http.HttpSession session)
      Saves the chart as a PNG format file in the temporary directory.
      static java.lang.String searchReplace(java.lang.String inputString, java.lang.String searchString, java.lang.String replaceString)
      Perform a search/replace operation on a String There are String methods to do this since (JDK 1.4)
      static void sendTempFile(java.io.File file, javax.servlet.http.HttpServletResponse response)
      Binary streams the specified file to the HTTP response in 1KB chunks.
      static void sendTempFile(java.io.File file, javax.servlet.http.HttpServletResponse response, java.lang.String mimeType)
      Binary streams the specified file to the HTTP response in 1KB chunks.
      static void sendTempFile(java.lang.String filename, javax.servlet.http.HttpServletResponse response)
      Binary streams the specified file in the temporary directory to the HTTP response in 1KB chunks.
      static void setTempFilePrefix(java.lang.String prefix)
      Sets the prefix for the temporary file names generated by this class.
      static void setTempOneTimeFilePrefix(java.lang.String prefix)
      Sets the prefix for the "one time" temporary file names generated by this class.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ServletUtilities

        public ServletUtilities()
    • Method Detail

      • getTempFilePrefix

        public static java.lang.String getTempFilePrefix()
        Returns the prefix for the temporary file names generated by this class.
        Returns:
        The prefix (never null).
      • setTempFilePrefix

        public static void setTempFilePrefix(java.lang.String prefix)
        Sets the prefix for the temporary file names generated by this class.
        Parameters:
        prefix - the prefix (null not permitted).
      • getTempOneTimeFilePrefix

        public static java.lang.String getTempOneTimeFilePrefix()
        Returns the prefix for "one time" temporary file names generated by this class.
        Returns:
        The prefix.
      • setTempOneTimeFilePrefix

        public static void setTempOneTimeFilePrefix(java.lang.String prefix)
        Sets the prefix for the "one time" temporary file names generated by this class.
        Parameters:
        prefix - the prefix (null not permitted).
      • saveChartAsPNG

        public static java.lang.String saveChartAsPNG(JFreeChart chart,
                                                      int width,
                                                      int height,
                                                      javax.servlet.http.HttpSession session)
                                               throws java.io.IOException
        Saves the chart as a PNG format file in the temporary directory.
        Parameters:
        chart - the JFreeChart to be saved.
        width - the width of the chart.
        height - the height of the chart.
        session - the HttpSession of the client (if null, the temporary file is marked as "one-time" and deleted by the DisplayChart servlet right after it is streamed to the client).
        Returns:
        The filename of the chart saved in the temporary directory.
        Throws:
        java.io.IOException - if there is a problem saving the file.
      • saveChartAsPNG

        public static java.lang.String saveChartAsPNG(JFreeChart chart,
                                                      int width,
                                                      int height,
                                                      ChartRenderingInfo info,
                                                      javax.servlet.http.HttpSession session)
                                               throws java.io.IOException
        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).
        width - the width of the chart.
        height - the height of the chart.
        info - the ChartRenderingInfo object to be populated (null permitted).
        session - the HttpSession of the client (if null, the temporary file is marked as "one-time" and deleted by the DisplayChart servlet right after it is streamed to the client).
        Returns:
        The filename of the chart saved in the temporary directory.
        Throws:
        java.io.IOException - if there is a problem saving the file.
      • saveChartAsJPEG

        public static java.lang.String saveChartAsJPEG(JFreeChart chart,
                                                       int width,
                                                       int height,
                                                       javax.servlet.http.HttpSession session)
                                                throws java.io.IOException
        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.
        width - the width of the chart.
        height - the height of the chart.
        session - the HttpSession of the client (if null, the temporary file is marked as "one-time" and deleted by the DisplayChart servlet right after it is streamed to the client).
        Returns:
        The filename of the chart saved in the temporary directory.
        Throws:
        java.io.IOException - if there is a problem saving the file.
      • saveChartAsJPEG

        public static java.lang.String saveChartAsJPEG(JFreeChart chart,
                                                       int width,
                                                       int height,
                                                       ChartRenderingInfo info,
                                                       javax.servlet.http.HttpSession session)
                                                throws java.io.IOException
        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).
        width - the width of the chart
        height - the height of the chart
        info - the ChartRenderingInfo object to be populated
        session - the HttpSession of the client (if null, the temporary file is marked as "one-time" and deleted by the DisplayChart servlet right after it is streamed to the client).
        Returns:
        The filename of the chart saved in the temporary directory
        Throws:
        java.io.IOException - if there is a problem saving the file.
      • sendTempFile

        public static void sendTempFile(java.lang.String filename,
                                        javax.servlet.http.HttpServletResponse response)
                                 throws java.io.IOException
        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.
        response - the HTTP response object.
        Throws:
        java.io.IOException - if there is an I/O problem.
      • sendTempFile

        public static void sendTempFile(java.io.File file,
                                        javax.servlet.http.HttpServletResponse response)
                                 throws java.io.IOException
        Binary streams the specified file to the HTTP response in 1KB chunks.
        Parameters:
        file - the file to be streamed.
        response - the HTTP response object.
        Throws:
        java.io.IOException - if there is an I/O problem.
      • sendTempFile

        public static void sendTempFile(java.io.File file,
                                        javax.servlet.http.HttpServletResponse response,
                                        java.lang.String mimeType)
                                 throws java.io.IOException
        Binary streams the specified file to the HTTP response in 1KB chunks.
        Parameters:
        file - the file to be streamed.
        response - the HTTP response object.
        mimeType - the mime type of the file, null allowed.
        Throws:
        java.io.IOException - if there is an I/O problem.
      • searchReplace

        public static java.lang.String searchReplace(java.lang.String inputString,
                                                     java.lang.String searchString,
                                                     java.lang.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.
        searchString - the search String.
        replaceString - the replace String.
        Returns:
        The String with the replacements made.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.