lt.monarch.chart.servlet
Class ChartServlet

java.lang.Object
  extended by HttpServlet
      extended by lt.monarch.chart.servlet.ImageServlet
          extended by lt.monarch.chart.servlet.ChartServlet

public abstract class ChartServlet
extends ImageServlet

Passes chart images to the browser. User is responsible just for creating the chart object. Servlet takes care of the rendering process, image creation, encoding and transmission to the browser.


Field Summary
Modifier and Type Field and Description
 
Fields inherited from class lt.monarch.chart.servlet.ImageServlet
encoder
 
Constructor Summary
Constructor and Description
ChartServlet()
           
 
Method Summary
Modifier and Type Method and Description
protected abstract  View createChart(HttpServletRequest req)
          Requests a chart be created for the HTTP request.
protected  java.awt.Image createImage(HttpServletRequest req)
          Triggers the createChart method.
protected  java.awt.Dimension getPreferredSize()
          Queries the size of the chart, to be served.
 
Methods inherited from class lt.monarch.chart.servlet.ImageServlet
doGet, getEncoder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChartServlet

public ChartServlet()
Method Detail

createChart

protected abstract View createChart(HttpServletRequest req)
                             throws ServletException
Requests a chart be created for the HTTP request.

Parameters:
req - servlet request
Returns:
chart to be returned to the browser
Throws:
ServletException - if the request for the GET could not be handled

getPreferredSize

protected java.awt.Dimension getPreferredSize()
Queries the size of the chart, to be served. This method has to be overridden to change chart size.

Returns:
preferred chart size

createImage

protected final java.awt.Image createImage(HttpServletRequest req)
                                    throws ServletException
Triggers the createChart method. The returned chart is then rendered into an image and the image is returned.

Specified by:
createImage in class ImageServlet
Parameters:
req - an HttpServletRequest object that contains the request the client has made of the servlet
Returns:
the Image object containing rendered chart
Throws:
ServletException - if the request for the GET could not be handled