org.ujac.web.servlet
Class ServletDocumentPrinter

java.lang.Object
  extended by org.ujac.web.servlet.ServletDocumentPrinter

public class ServletDocumentPrinter
extends Object

Name: ServletDocumentPrinter
Description: A helper class that eases the usage of the DocumentPrinter within servlets.

Author:
lauerc

Constructor Summary
ServletDocumentPrinter(InputStream templateStream, Map properties)
          Constructs a ServletDocumentPrinter instance with no specific attributes.
ServletDocumentPrinter(String templateSource, Map properties)
          Constructs a ServletDocumentPrinter instance with no specific attributes.
 
Method Summary
 DocumentPrinter getDocumentPrinter()
          Gets the document printer instance.
 void printDocument(HttpServletRequest request, HttpServletResponse response)
          Generates a PDF and writes it to the servlet output stream.
 void printDocument(HttpServletRequest request, HttpServletResponse response, boolean supportToc)
          Generates a PDF and writes it to the servlet output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletDocumentPrinter

public ServletDocumentPrinter(String templateSource,
                              Map properties)
                       throws IOException
Constructs a ServletDocumentPrinter instance with no specific attributes.

Parameters:
templateSource - The template source which is loaded from the class path.
properties - The document's properties.
Throws:
IOException - In case the template could not be read.

ServletDocumentPrinter

public ServletDocumentPrinter(InputStream templateStream,
                              Map properties)
                       throws IOException
Constructs a ServletDocumentPrinter instance with no specific attributes.

Parameters:
templateStream - The template input stream.
properties - The document's properties.
Throws:
IOException - In case the template could not be read.
Method Detail

getDocumentPrinter

public DocumentPrinter getDocumentPrinter()
Gets the document printer instance.

Returns:
The document printer instance.

printDocument

public void printDocument(HttpServletRequest request,
                          HttpServletResponse response)
                   throws IOException,
                          UjacException
Generates a PDF and writes it to the servlet output stream.

Parameters:
request - The HTTP request.
response - The HTTP response.
Throws:
IOException - In case an I/O problem occurred.
UjacException - In case an UJAC related problem occurred.

printDocument

public void printDocument(HttpServletRequest request,
                          HttpServletResponse response,
                          boolean supportToc)
                   throws IOException,
                          UjacException
Generates a PDF and writes it to the servlet output stream.

Parameters:
request - The HTTP request.
response - The HTTP response.
supportToc - Tells whether or not to support the output of a leading table of contents.
Throws:
IOException - In case an I/O problem occurred.
UjacException - In case an UJAC related problem occurred.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.