com.jrefinery.report.ext.demo
Class JFreeReportHtmlServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bycom.jrefinery.report.ext.demo.JFreeReportHtmlServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class JFreeReportHtmlServlet
extends javax.servlet.http.HttpServlet

A Sample HttpServlet to show how JFreeReports can be used to generate PDF content in a webbased environment.

POST and GET are handled equal, so it does not matter whether you POST or GET the URL for this servlet.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
JFreeReportHtmlServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles the GET method for the servlet.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles the POST method for the request.
 
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, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JFreeReportHtmlServlet

public JFreeReportHtmlServlet()
Method Detail

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
Handles the GET method for the servlet. The GET method is mapped to the POST method, both commands are handled equal.

Parameters:
request - the http request object.
response - the http response object.
Throws:
javax.servlet.ServletException - if an error occured, which could not be handled internaly.
java.io.IOException - if writing the generated contents failed.

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
Handles the POST method for the request. This parses the report definition, loads the tablemodel and generates a single page of the report. The generated page is returned as StreamHtml file, with the implicit restriction, that generated images are not included. External referenced images are included, if they are loaded from an Http or Ftp or File source.

Parameters:
request - the http request object.
response - the http response object.
Throws:
javax.servlet.ServletException - if an error occured, which could not be handled internaly.
java.io.IOException - if writing the generated contents failed.