Google Chart servlet 1.1

    It is a Java servlet implements proxy for Google Chart. Servlet requests Google Chart and caches the generated image. So all the sub-sequent requests will be served right from your own site. It lets you keep Google Charts limit (50 000 requests per user) and improve the performance.

How to use it:

a) copy chartPackage.jar into your WEB-INF/lib directory.

b) define ChartServlet in your web.xml file. You can set the following initial parameters:

dir - Describes an existing directory on your server for the saved content
proxyHost - Optional parameter. Describes a proxy host for your internet connection
proxyPort - Optional parameter. Describes a proxy port for your internet connection
expires - Optional parameter. This parameter describes a caching time (in seconds) for the images (client side cache).

For example:
 

    <servlet>
     <servlet-name>ChartServlet</servlet-name>
     <servlet-class>com.jsos.chart.GoogleChart</servlet-class>
     <init-param>
      <param-name>dir</param-name>
      <param-value>/home/dump</param-value>
     </init-param>
    </servlet>

c) define a mapping for ChartServlet:
 

    <servlet-mapping>
     <servlet-name>ChartServlet</servlet-name>
     <url-pattern>/servlet/chart</url-pattern>
    </servlet-mapping>

For the charts generation parameters see Google Charts API. Servlets obviously uses the same set of parameters. E.g.:

/servlets/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World

chart

    For downloading:  chartPackage.jar   
 

  © Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

Also in JSOS: