public class ServletUtilities extends Object
Constructor and Description |
---|
ServletUtilities() |
Modifier and Type | Method and Description |
---|---|
static String |
getTempFilePrefix()
Returns the prefix for the temporary file names generated by this class.
|
static String |
getTempOneTimeFilePrefix()
Returns the prefix for "one time" temporary file names generated by
this class.
|
static 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 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 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 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 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)
|
static void |
sendTempFile(File file,
javax.servlet.http.HttpServletResponse response)
Binary streams the specified file to the HTTP response in 1KB chunks.
|
static void |
sendTempFile(File file,
javax.servlet.http.HttpServletResponse response,
String mimeType)
Binary streams the specified file to the HTTP response in 1KB chunks.
|
static void |
sendTempFile(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(String prefix)
Sets the prefix for the temporary file names generated by this class.
|
static void |
setTempOneTimeFilePrefix(String prefix)
Sets the prefix for the "one time" temporary file names generated by
this class.
|
public static String getTempFilePrefix()
null
).public static void setTempFilePrefix(String prefix)
prefix
- the prefix (null
not permitted).public static String getTempOneTimeFilePrefix()
public static void setTempOneTimeFilePrefix(String prefix)
prefix
- the prefix (null
not permitted).public static String saveChartAsPNG(JFreeChart chart, int width, int height, javax.servlet.http.HttpSession session) throws IOException
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).IOException
- if there is a problem saving the file.public static String saveChartAsPNG(JFreeChart chart, int width, int height, ChartRenderingInfo info, javax.servlet.http.HttpSession session) throws IOException
ChartRenderingInfo
object which can be used to
generate an HTML image map.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).IOException
- if there is a problem saving the file.public static String saveChartAsJPEG(JFreeChart chart, int width, int height, javax.servlet.http.HttpSession session) throws IOException
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.
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).IOException
- if there is a problem saving the file.public static String saveChartAsJPEG(JFreeChart chart, int width, int height, ChartRenderingInfo info, javax.servlet.http.HttpSession session) throws IOException
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.
chart
- the chart to be saved (null
not permitted).width
- the width of the chartheight
- the height of the chartinfo
- the ChartRenderingInfo object to be populatedsession
- 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).IOException
- if there is a problem saving the file.public static void sendTempFile(String filename, javax.servlet.http.HttpServletResponse response) throws IOException
filename
- the name of the file in the temporary directory.response
- the HTTP response object.IOException
- if there is an I/O problem.public static void sendTempFile(File file, javax.servlet.http.HttpServletResponse response) throws IOException
file
- the file to be streamed.response
- the HTTP response object.IOException
- if there is an I/O problem.public static void sendTempFile(File file, javax.servlet.http.HttpServletResponse response, String mimeType) throws IOException
file
- the file to be streamed.response
- the HTTP response object.mimeType
- the mime type of the file, null allowed.IOException
- if there is an I/O problem.public static String searchReplace(String inputString, String searchString, String replaceString)
inputString
- the String to have the search/replace operation.searchString
- the search String.replaceString
- the replace String.Jas4pp 1.5 © Java Analysis Studio for Particle Physics