org.dbforms.servlets.reports
Class ReportServletAbstract

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.dbforms.servlets.reports.ReportServletAbstract
All Implemented Interfaces:
Serializable, Servlet, ServletConfig
Direct Known Subclasses:
JasperReportServlet, LineReportServletAbstract

public abstract class ReportServletAbstract
extends HttpServlet

This is the abstract base class for generating reports.

Author:
Henner Kollmann
See Also:
Serialized Form

Constructor Summary
ReportServletAbstract()
           
 
Method Summary
protected  void compileReport(ServletContext context, String reportFile)
           
 void doGet(HttpServletRequest request, HttpServletResponse response)
          Basic servlet method, answers requests from the browser.
 void doPost(HttpServletRequest request, HttpServletResponse response)
          Basic servlet method, answers requests fromt the browser.
protected abstract  String getReportFileExtension()
           
protected  void handleException(HttpServletRequest request, HttpServletResponse response, Exception e)
           
 void init()
          Initialize this servlet.
protected  void process(HttpServletRequest request, HttpServletResponse response)
          generates a report from request.
protected abstract  ReportWriter processReport(String reportFileFullName, JRDataSourceAbstract dataSource, ServletContext context, HttpServletRequest request, HttpServletResponse response)
          generates a report.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, 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
 

Constructor Detail

ReportServletAbstract

public ReportServletAbstract()
Method Detail

doGet

public final void doGet(HttpServletRequest request,
                        HttpServletResponse response)
                 throws ServletException,
                        IOException
Basic servlet method, answers requests from the browser.

Overrides:
doGet in class HttpServlet
Parameters:
request - HTTPServletRequest
response - HTTPServletResponse
Throws:
ServletException - if there is a servlet problem.
IOException - if there is an I/O problem.

doPost

public final void doPost(HttpServletRequest request,
                         HttpServletResponse response)
                  throws ServletException,
                         IOException
Basic servlet method, answers requests fromt the browser.

Overrides:
doPost in class HttpServlet
Parameters:
request - HTTPServletRequest
response - HTTPServletResponse
Throws:
ServletException - if there is a servlet problem.
IOException - if there is an I/O problem.

init

public void init()
          throws ServletException
Initialize this servlet.

Overrides:
init in class GenericServlet
Throws:
ServletException - if we cannot configure ourselves correctly

processReport

protected abstract ReportWriter processReport(String reportFileFullName,
                                              JRDataSourceAbstract dataSource,
                                              ServletContext context,
                                              HttpServletRequest request,
                                              HttpServletResponse response)
generates a report.

Parameters:
reportFileFullName - filename of report to process reportHTTPServletRequest generated by getReportFile! getReportFile should be called before fetching data, so that error handling of report not found e.g. could be processed first!
dataSource - data for the report
context - ServletContext
request - HTTPServletRequest
response - HTTPServletResponse

getReportFileExtension

protected abstract String getReportFileExtension()

handleException

protected final void handleException(HttpServletRequest request,
                                     HttpServletResponse response,
                                     Exception e)

compileReport

protected void compileReport(ServletContext context,
                             String reportFile)
                      throws Exception
Throws:
Exception

process

protected void process(HttpServletRequest request,
                       HttpServletResponse response)
generates a report from request. Tries to get data from DbForms.

Parameters:
request - HTTPServletRequest
response - HTTPServletResponse


Copyright © 2002-2005 DbForms. All Rights Reserved.