fop 0.90alpha1

org.apache.fop.servlet
Class FopPrintServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.apache.fop.servlet.FopPrintServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class FopPrintServlet
extends javax.servlet.http.HttpServlet

Example servlet to generate a fop printout from a servlet. Printing goes to the default printer on host where the servlet executes. Servlet param is:

or
Example URL: http://servername/fop/servlet/FopPrintServlet?fo=readme.fo
Example URL: http://servername/fop/servlet/FopPrintServlet?xml=data.xml&xsl=format.xsl

Version:
$Id: FopPrintServlet.java 332791 2005-11-12 15:58:07Z jeremias $ (todo) Doesn't work since there's no AWTRenderer at the moment. Revisit when available. (todo) Ev. add caching mechanism for Templates objects
Author:
Apache XML FOP Development Team
See Also:
Serialized Form

Field Summary
protected static java.lang.String FO_REQUEST_PARAM
          Name of the parameter used for the XSL-FO file
protected  org.apache.commons.logging.impl.SimpleLog log
          Logger to give to FOP
protected  javax.xml.transform.TransformerFactory transFactory
          The TransformerFactory to use to create Transformer instances
protected static java.lang.String XML_REQUEST_PARAM
          Name of the parameter used for the XML file
protected static java.lang.String XSLT_REQUEST_PARAM
          Name of the parameter used for the XSLT file
 
Constructor Summary
FopPrintServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void init()
           
 void renderFO(java.io.InputStream foFile, javax.servlet.http.HttpServletResponse response)
          Renders an FO inputsource to the default printer.
 void renderXML(java.io.File xmlfile, java.io.File xsltfile, javax.servlet.http.HttpServletResponse response)
          Renders an FO generated using an XML and a stylesheet to the default printer.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doOptions, doPost, 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
 

Field Detail

FO_REQUEST_PARAM

protected static final java.lang.String FO_REQUEST_PARAM
Name of the parameter used for the XSL-FO file

XML_REQUEST_PARAM

protected static final java.lang.String XML_REQUEST_PARAM
Name of the parameter used for the XML file

XSLT_REQUEST_PARAM

protected static final java.lang.String XSLT_REQUEST_PARAM
Name of the parameter used for the XSLT file

log

protected org.apache.commons.logging.impl.SimpleLog log
Logger to give to FOP

transFactory

protected javax.xml.transform.TransformerFactory transFactory
The TransformerFactory to use to create Transformer instances
Constructor Detail

FopPrintServlet

public FopPrintServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Overrides:
init in class javax.servlet.GenericServlet
See Also:
GenericServlet.init()

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException
Overrides:
doGet in class javax.servlet.http.HttpServlet
See Also:
HttpServlet.doGet(HttpServletRequest, HttpServletResponse)

renderFO

public void renderFO(java.io.InputStream foFile,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException
Renders an FO inputsource to the default printer.
Parameters:
foFile - The XSL-FO file
response - Response to write to
Throws:
javax.servlet.ServletException - In case of a problem

renderXML

public void renderXML(java.io.File xmlfile,
                      java.io.File xsltfile,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException
Renders an FO generated using an XML and a stylesheet to the default printer.
Parameters:
xmlfile - XML file object
xsltfile - XSLT stylesheet
response - HTTP response object
Throws:
javax.servlet.ServletException - In case of a problem

fop 0.90alpha1

Copyright 1999-2005 The Apache Software Foundation. All Rights Reserved.