org.foray.demo.servlet
Class DemoPrintServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.foray.demo.servlet.AbstractDemoServlet
              extended by org.foray.demo.servlet.DemoPrintServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class DemoPrintServlet
extends AbstractDemoServlet

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

Example URL: http://servername/foray/servlet/DemoPrintServlet?fo=readme.fo Example URL: http://servername/foray/servlet/DemoPrintServlet?xml=data.xml&xsl=format.xsl Compiling: you will need - servlet_2_2.jar - foray.jar - sax api Running: you will need in the WEB-INF/lib/ directory: - foray.jar - batik.jar - xalan-2.0.0.jar

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.foray.demo.servlet.AbstractDemoServlet
FO_REQUEST_PARAM, XML_REQUEST_PARAM, XSL_REQUEST_PARAM
 
Constructor Summary
DemoPrintServlet()
          Constructor.
 
Method Summary
protected  String getContentType()
          Return the content type.
protected  OutputTargetType getRendererType()
          Return the renderer type.
 void renderFO(InputSource inputSource, javax.servlet.http.HttpServletResponse response)
          Renders an FO inputsource into a PDF file which is written directly to the response object's OutputStream.
 void renderXML(File xmlFile, File xslFile, javax.servlet.http.HttpServletResponse response)
          Renders an XML file into a PDF file by applying a stylesheet that converts the XML to XSL:FO.
 
Methods inherited from class org.foray.demo.servlet.AbstractDemoServlet
doGet, getLogger, setupJAXPDocument, setupSAXDocument, setupSession
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, 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

DemoPrintServlet

public DemoPrintServlet()
Constructor.

Method Detail

getContentType

protected String getContentType()
Description copied from class: AbstractDemoServlet
Return the content type.

Specified by:
getContentType in class AbstractDemoServlet
Returns:
The content type.

getRendererType

protected OutputTargetType getRendererType()
Description copied from class: AbstractDemoServlet
Return the renderer type.

Specified by:
getRendererType in class AbstractDemoServlet
Returns:
The renderer type.

renderFO

public void renderFO(InputSource inputSource,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException
Description copied from class: AbstractDemoServlet
Renders an FO inputsource into a PDF file which is written directly to the response object's OutputStream.

Overrides:
renderFO in class AbstractDemoServlet
Parameters:
inputSource - A SAX input handler.
response - The Servlet response.
Throws:
javax.servlet.ServletException - For exceptions during processing.

renderXML

public void renderXML(File xmlFile,
                      File xslFile,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException
Description copied from class: AbstractDemoServlet
Renders an XML file into a PDF file by applying a stylesheet that converts the XML to XSL:FO. The PDF is written directly to the response object's OutputStream.

Overrides:
renderXML in class AbstractDemoServlet
Parameters:
xmlFile - The semantic XML file to be transformed.
xslFile - The stylesheet to be applied to xmlFile.
response - The HTTP servlet response.
Throws:
javax.servlet.ServletException - For errors during processing.


Copyright © 2017. All rights reserved.