Hello
Can anyone tell me if they know how to use the Google Chart API to store the image returned in the file system rather than be included in a webpage?
My situation is that I'd like a Java servlet or a listener to run at regular intervals on an Apache Tomcat server to make HTTP GET / POST requests to the Google Chart API and store the resulting images in the file system or application database. Later on the images would be placed in HTML pages.
Presumably I'm looking at something like this:
String result = null;
URL url = new URL(urlStr);
URLConnection conn = url.openConnection ();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuffer sb = new StringBuffer();
String line;
while ((line = rd.readLine()) != null)
{
sb.append(line);
}
rd.close();
result = sb.toString();
Where result is the image which can be written to file or database? But where some output may have to be stripped out.
Any advice is welcome.
Mr Morgan.