|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.http.HttpServlet | +--com.jrefinery.chart.demo.jdbc.servlet.BaseImageServlet
A Base image servlet generator. Used to provide common base and methods to servlets which need to generate a chart from sql data sources To extend overwrite method : generateSQL. Will attempt to get configuration constants from the firstly the servlet container configuration and then secondly the servlet's initialization parameters. The servlets initialization parameters taking precedence. Available configuration options are:
DBuser | The database user to connect as |
DBpwd | The password for the database user |
DBschema | The schema to utilise |
DBurl | The connection URL to the database |
DBdriver | The JDBC driver to utilise to connect to the database |
NAME | TYPE | NOTES |
---|---|---|
type | integer | the type of chart to generate. eg moving average, linear fit etc under development. |
width | integer | The width of output in pixels. Clipped into the range 10-2000 |
height | integer | The height of the output in pixels. Clipped into the range 10-1000 |
initColor | integer | Between 0-11, used to indicate the initial shading of the background finalColor integer Between 0-11, used to indicate the final shading of the background |
title | String | The chart title |
xaxistitle | String | The x axis title |
yaxistitle | String | The y axis title |
zero | String | if passed a value of 'true' then the chart will include zero |
showLegend | String | if passed a value of 'false' then the chart will not include legend |
output | String | Selection of the type of output requested. jpeg, gif, svg |
JFreeChart
,
JFreeChartServletDemo
, Serialized FormField Summary | |
protected java.lang.String |
chartTitle
Title of the chart |
protected boolean |
debug
Whether or not to enable debug information output |
protected java.lang.String |
servletName
The servlets name |
protected int |
sqlServerType
|
protected java.lang.String |
xAxisTitle
Title of the x axis |
protected java.lang.String |
yAxisTitle
Title of the y axis |
Fields inherited from interface com.jrefinery.chart.demo.jdbc.servlet.Constants |
CAUTION_FILE, CONTENT_TYPE, DB_CONNECTION, DB_DRIVER, DB_PASSWORD, DB_SCHEMA, DB_SERVER, DB_URL, DB_USER, DEBUG, FOOTER, FOOTER_FILE, HEADER, HEADER_FILE, IMAGE_URL, MYSQL, ORACLE, ORGANISATION, REPLACE_SCHEMA, RESPONSE_HTML, RESPONSE_JPEG, RESPONSE_PDF, RESPONSE_PNG, RESPONSE_PS, RESPONSE_SVG, SHARED_DB, SHARED_DB_OPENER, SHARED_VOYAGES, SHARED_VOYAGES_TIME |
Constructor Summary | |
BaseImageServlet()
|
Method Summary | |
protected JFreeChart |
createCategoryChart(int type,
java.lang.String sql)
Create a chart |
protected JFreeChart |
createChart(int type,
java.lang.String sql)
|
protected JFreeChart |
createPieChart(int type,
java.lang.String sql)
Create a chart |
protected JFreeChart |
createXYChart(int type,
java.lang.String sql)
Create a chart |
void |
destroy()
Description of the Method |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Basic servlet method, answers requests from the browser. |
void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Process the HTTP Post request |
protected java.awt.image.BufferedImage |
draw(JFreeChart chart,
int width,
int height)
|
protected java.lang.String |
generateSQL(javax.servlet.http.HttpServletRequest request)
Generate the SQL required from the http request |
protected java.awt.Color |
getColor(int color)
Gets the color attribute of the passed integer |
void |
init(javax.servlet.ServletConfig config)
Override init() to set up data used by invocations of this servlet. |
void |
modifyChart(JFreeChart chart,
javax.servlet.http.HttpServletRequest request)
Override this method if you would like to modify the generated chart parameters / options |
protected void |
openConnection()
Description of the Method |
protected boolean |
testConnection()
Description of the Method |
protected void |
writeErrorPage(javax.servlet.http.HttpServletResponse response,
java.lang.String message)
|
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int sqlServerType
protected java.lang.String servletName
protected boolean debug
protected java.lang.String chartTitle
protected java.lang.String xAxisTitle
protected java.lang.String yAxisTitle
Constructor Detail |
public BaseImageServlet()
Method Detail |
protected java.awt.Color getColor(int color)
color
- The colour indexprotected JFreeChart createChart(int type, java.lang.String sql)
protected JFreeChart createXYChart(int type, java.lang.String sql)
type
- Type of chart to create. Currently not supported.sql
- SQL to execute. 1st column is x values, following columns
are y valuesprotected JFreeChart createPieChart(int type, java.lang.String sql)
type
- Type of chart to create. Currently not supported.sql
- SQL to execute. 1st column is category, followed by valueprotected JFreeChart createCategoryChart(int type, java.lang.String sql)
type
- Type of chart to create. Currently not supported.sql
- SQL to execute. 1st column is category, followed by valuepublic void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
init
in class javax.servlet.GenericServlet
config
- Description of the Parameterjavax.servlet.ServletException
- Description of the Exceptionprotected java.lang.String generateSQL(javax.servlet.http.HttpServletRequest request)
request
- The servlets request parameterspublic void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
doGet
in class javax.servlet.http.HttpServlet
request
- HTTPServletRequestresponse
- HTTPServletResponsejavax.servlet.ServletException
- Description of the Exceptionjava.io.IOException
- Description of the Exceptionpublic void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
doPost
in class javax.servlet.http.HttpServlet
request
- Description of the Parameterresponse
- Description of the Parameterjavax.servlet.ServletException
- Description of the Exceptionjava.io.IOException
- Description of the Exceptionprotected java.awt.image.BufferedImage draw(JFreeChart chart, int width, int height)
chart
- Description of the Parameterwidth
- Description of the Parameterheight
- Description of the Parameterpublic void modifyChart(JFreeChart chart, javax.servlet.http.HttpServletRequest request)
chart
- The generated chart.request
- The HTTP request.public void destroy()
destroy
in class javax.servlet.GenericServlet
protected void openConnection()
protected boolean testConnection()
protected void writeErrorPage(javax.servlet.http.HttpServletResponse response, java.lang.String message)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |