ChartDirector 5.1 (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 BaseChart.setSearchPath for the various methods ChartDirector uses to search for images.

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 directories are supported by separating them with semi-colons.

For example, a common practice for many web applications is to put all images files in an "/images" subdirectory. In these cases, 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 semi-colons.

Return Value

None