ChartDirector 7.0 (Java Edition)

BaseChart.setSearchPath3


Usage

public void setSearchPath3(ServletContext context[, ServletRequest request[, String path ]])

Description

Search for image files using the ServletContext and ServletRequest.

Please refer to Path Specification on how ChartDirector interprets pathnames.

With setSearchPath3, ChartDirector will use the "servlet context" (that is, the path to the web application) as the root of the image path. For example, if the web application is called "myWebApp", and the image path is "/mydir/imagefile.gif", ChartDirector will locate the image assuming it is a resource at:

http://aaa.bbb.ccc.ddd/myWebApp/mydir/imagefile.gif

If the image path is a relative path, it will be interpreted as relative to the current servlet request path.

The setSearchPath3 accepts an optional argument for specifying a search path for the image. Multiple search paths are supported by separating them with semicolons.

For example, a common practice for many web applications is to put all images files in an "/images" subdirectory. In this case, you can set the search path to "/images".

Arguments

ArgumentDefaultDescription
context(Mandatory)The ServletContext used to resolve absolute paths. This object is usually obtained by using "getServletConfig().getServletContext()" in the Servlet.
requestnullThe ServletRequest used to resolve relative paths. In JSP, this is the predefined variable "request". In a servlet, this object is available as the parameter passed in from the doGet or doPost method. null means all paths (relative or absolute) will be resolved using the ServletContext.
pathnullThe search path to use. Multiple directories are supported by separating them with semicolons.

Return Value

None