From 1eb6990ec5bcb0e9895ab17963253616405780a6 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Mon, 13 Jan 2003 16:27:14 +0000 Subject: [PATCH] Example Servlet moved over from contrib/servlet git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@195848 13f79535-47bb-0310-9956-ffa450edef68 --- examples/servlet/.cvsignore | 1 + examples/servlet/README | 21 ++ examples/servlet/build.bat | 34 +++ examples/servlet/build.sh | 29 +++ examples/servlet/build.xml | 90 ++++++++ examples/servlet/conf/web.xml | 21 ++ examples/servlet/lib/servlet-2.2.jar | Bin 0 -> 39553 bytes examples/servlet/lib/servlet.LICENSE.txt | 59 ++++++ examples/servlet/src/FopPrintServlet.java | 241 ++++++++++++++++++++++ examples/servlet/src/FopServlet.java | 138 +++++++++++++ 10 files changed, 634 insertions(+) create mode 100644 examples/servlet/.cvsignore create mode 100644 examples/servlet/README create mode 100755 examples/servlet/build.bat create mode 100644 examples/servlet/build.sh create mode 100644 examples/servlet/build.xml create mode 100644 examples/servlet/conf/web.xml create mode 100644 examples/servlet/lib/servlet-2.2.jar create mode 100644 examples/servlet/lib/servlet.LICENSE.txt create mode 100644 examples/servlet/src/FopPrintServlet.java create mode 100644 examples/servlet/src/FopServlet.java diff --git a/examples/servlet/.cvsignore b/examples/servlet/.cvsignore new file mode 100644 index 000000000..378eac25d --- /dev/null +++ b/examples/servlet/.cvsignore @@ -0,0 +1 @@ +build diff --git a/examples/servlet/README b/examples/servlet/README new file mode 100644 index 000000000..ab262840f --- /dev/null +++ b/examples/servlet/README @@ -0,0 +1,21 @@ +FOP Servlet Readme + +This directory contains two sample servlets that use FOP: + +- FopServlet can take a XSL:FO file or a XML+XSLT as parameters to create a PDF +that is being shown in the browser. + +- FopPrintServlet has the same parameters but prints the generated document to +the default printer instead of generating a PDF. + +Creating the WAR file: + +1. Run build.bat (on Windows) or build.sh (on Unix) to create the WAR file. +2. Deploy the WAR file in your favourite web container. + +Sample URLs: +http://localhost:8080/fop/servlet/FopServlet?fo=readme.fo +http://localhost:8080/fop/servlet/FopPrintServlet?fo=readme.fo + +Tip: If you have problems using Internet Explorer, try this URL: +http://localhost:8080/fop/servlet/FopServlet?fo=readme.fo&ext=.pdf diff --git a/examples/servlet/build.bat b/examples/servlet/build.bat new file mode 100755 index 000000000..d7974a4a1 --- /dev/null +++ b/examples/servlet/build.bat @@ -0,0 +1,34 @@ +@echo off + +echo Fop Build System +echo ---------------- + +if "%JAVA_HOME%" == "" goto error + +set LIBDIR=../../lib +set LOCALCLASSPATH=%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\classes.zip +set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\ant-1.5.1.jar +set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis.jar +set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xercesImpl-2.2.1.jar +set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.4.1.jar + +set ANT_HOME=%LIBDIR% + +echo Building with classpath %LOCALCLASSPATH% + +echo Starting Ant... + +%JAVA_HOME%\bin\java.exe -Dant.home=%ANT_HOME% -classpath "%LOCALCLASSPATH%" org.apache.tools.ant.Main %1 %2 %3 %4 %5 + +goto end + +:error + +echo ERROR: JAVA_HOME not found in your environment. +echo Please, set the JAVA_HOME variable in your environment to match the +echo location of the Java Virtual Machine you want to use. + +:end + +rem set LOCALCLASSPATH= + diff --git a/examples/servlet/build.sh b/examples/servlet/build.sh new file mode 100644 index 000000000..ba56fdc8e --- /dev/null +++ b/examples/servlet/build.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# This file should be executable. +echo +echo "Fop Build System" +echo "----------------" +echo + +if [ "$JAVA_HOME" = "" ] ; then + echo "ERROR: JAVA_HOME not found in your environment." + echo + echo "Please, set the JAVA_HOME variable in your environment to match the" + echo "location of the Java Virtual Machine you want to use." + exit 1 +fi +LIBDIR=../../lib +LOCALCLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/classes.zip +LOCALCLASSPATH=$LOCALCLASSPATH:$LIBDIR/ant-1.5.1.jar +LOCALCLASSPATH=$LOCALCLASSPATH:$LIBDIR/xml-apis.jar +LOCALCLASSPATH=$LOCALCLASSPATH:$LIBDIR/xercesImpl-2.2.1.jar +LOCALCLASSPATH=$LOCALCLASSPATH:$LIBDIR/xalan-2.4.1.jar + +ANT_HOME=$LIBDIR + +echo +echo Building with classpath $LOCALCLASSPATH +echo Starting Ant... +echo + +$JAVA_HOME/bin/java -Dant.home=$ANT_HOME -classpath "$LOCALCLASSPATH" org.apache.tools.ant.Main $* diff --git a/examples/servlet/build.xml b/examples/servlet/build.xml new file mode 100644 index 000000000..ed301d40c --- /dev/null +++ b/examples/servlet/build.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/servlet/conf/web.xml b/examples/servlet/conf/web.xml new file mode 100644 index 000000000..4c5bad35e --- /dev/null +++ b/examples/servlet/conf/web.xml @@ -0,0 +1,21 @@ + + + + + Fop + FopServlet + + + Fop + / + + + FopPrint + FopPrintServlet + + + FopPrint + /fopprint + + diff --git a/examples/servlet/lib/servlet-2.2.jar b/examples/servlet/lib/servlet-2.2.jar new file mode 100644 index 0000000000000000000000000000000000000000..872854a431b14b75b9caf0c96de81a6f179c0f0f GIT binary patch literal 39553 zcma&O1CXWJ(k@)pW!tuGcUfJwZQHi(>auOyw(Tz4{Cj53fA4qB`DWs7?}%Ix`_0Vt zWai2zx2z-(FeJbqHyKk2sy{#c>jmQXyOgjZKaIGw2%YTz5j)pfp!}a=pufME>pAPW z{tuap|B!+GKQazR_Rf|@j{hKw^k1^3j*hnfumJJD7MMHylRU=%D(|RgV&wYQ??MIu z|9$_@>m>ZIWuivbM)qa~3V&S^t%0SUgF}?!g*}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z4Bk-N;Ux0tT zIQ|*. + * + * ==================================================================== + * + * This source code implements specifications defined by the Java + * Community Process. In order to remain compliant with the specification + * DO NOT add / change / or delete method signatures! + */ diff --git a/examples/servlet/src/FopPrintServlet.java b/examples/servlet/src/FopPrintServlet.java new file mode 100644 index 000000000..792a14d9c --- /dev/null +++ b/examples/servlet/src/FopPrintServlet.java @@ -0,0 +1,241 @@ +/* + * $Id$ + * Copyright (C) 2002 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +import java.io.*; +import java.util.Vector ; + +import java.awt.print.PrinterJob ; +import java.awt.print.PrinterException ; + +import javax.servlet.*; +import javax.servlet.http.*; + +import org.xml.sax.InputSource; +import org.xml.sax.XMLReader; + +import org.apache.fop.apps.Driver; +import org.apache.fop.layout.Page; +import org.apache.fop.apps.Version; +import org.apache.fop.apps.XSLTInputHandler; +import org.apache.fop.messaging.MessageHandler; + +import org.apache.fop.render.awt.AWTRenderer ; + +import org.apache.avalon.framework.logger.ConsoleLogger; +import org.apache.avalon.framework.logger.Logger; + +/** + * 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: + *
    + *
  • fo: the path to a formatting object file to render + *
+ * + * Example URL: http://servername/fop/servlet/FopPrintServlet?fo=readme.fo + * Example URL: http://servername/fop/servlet/FopPrintServlet?xml=data.xml&xsl=format.xsl + * Compiling: you will need + * - servlet_2_2.jar + * - fop.jar + * - sax api + * - avalon-framework-x.jar (where x is the version found the FOP lib dir) + * + * Running: you will need in the WEB-INF/lib/ directory: + * - fop.jar + * - batik.jar + * - avalon-framework-x.jar (where x is the version found the FOP lib dir) + * - xalan-2.0.0.jar + */ + +public class FopPrintServlet extends HttpServlet { + public static final String FO_REQUEST_PARAM = "fo"; + public static final String XML_REQUEST_PARAM = "xml"; + public static final String XSL_REQUEST_PARAM = "xsl"; + Logger log = null; + + public void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException { + if (log == null) { + log = new ConsoleLogger(ConsoleLogger.LEVEL_WARN); + MessageHandler.setScreenLogger(log); + } + + try { + String foParam = request.getParameter(FO_REQUEST_PARAM); + String xmlParam = request.getParameter(XML_REQUEST_PARAM); + String xslParam = request.getParameter(XSL_REQUEST_PARAM); + + if (foParam != null) { + FileInputStream file = new FileInputStream(foParam); + renderFO(new InputSource(file), response); + } else if ((xmlParam != null) && (xslParam != null)) { + XSLTInputHandler input = + new XSLTInputHandler(new File(xmlParam), + new File(xslParam)); + renderXML(input, response); + } else { + response.setContentType ("text/html"); + + PrintWriter out = response.getWriter(); + out.println("Error\n"+ "

FopServlet Error

No 'fo' or 'xml/xsl' "+ + "request param given.

"); + } + } catch (ServletException ex) { + throw ex; + } + catch (Exception ex) { + throw new ServletException(ex); + } + } + + /** + * Renders an FO inputsource to the default printer. + */ + public void renderFO(InputSource foFile, + HttpServletResponse response) throws ServletException { + try { + Driver driver = new Driver(foFile, null); + PrinterJob pj = PrinterJob.getPrinterJob(); + PrintRenderer renderer = new PrintRenderer(pj); + + driver.setLogger (log); + driver.setRenderer(renderer); + driver.run(); + + reportOK (response); + } catch (Exception ex) { + throw new ServletException(ex); + } + } + + /** + * Renders an FO generated using an XML and a stylesheet to the default printer. + */ + public void renderXML(XSLTInputHandler input, + HttpServletResponse response) throws ServletException { + try { + Driver driver = new Driver(); + PrinterJob pj = PrinterJob.getPrinterJob(); + PrintRenderer renderer = new PrintRenderer(pj); + + pj.setCopies(1); + + driver.setLogger (log); + driver.setRenderer (renderer); + driver.render (input.getParser(), input.getInputSource()); + + reportOK (response); + } catch (Exception ex) { + throw new ServletException(ex); + } + } + + // private helper, tell (browser) user that file printed + private void reportOK (HttpServletResponse response) + throws ServletException { + String sMsg = + "Success\n" + "

FopPrintServlet:

" + + "

The requested data was printed

" ; + + response.setContentType ("text/html"); + response.setContentLength (sMsg.length()); + + try { + PrintWriter out = response.getWriter(); + out.println (sMsg); + out.flush(); + } catch (Exception ex) { + throw new ServletException(ex); + } + } + + // This is stolen from PrintStarter + class PrintRenderer extends AWTRenderer { + + private static final int EVEN_AND_ALL = 0; + private static final int EVEN = 1; + private static final int ODD = 2; + + private int startNumber; + private int endNumber; + private int mode = EVEN_AND_ALL; + private int copies = 1; + private PrinterJob printerJob; + + PrintRenderer(PrinterJob printerJob) { + super(null); + + this.printerJob = printerJob; + startNumber = 0 ; + endNumber = -1; + + printerJob.setPageable(this); + + mode = EVEN_AND_ALL; + String str = System.getProperty("even"); + if (str != null) { + try { + mode = Boolean.valueOf(str).booleanValue() ? EVEN : ODD; + } catch (Exception e) {} + + } + } + + public void stopRenderer(OutputStream outputStream) + throws IOException { + super.stopRenderer(outputStream); + + if (endNumber == -1) + endNumber = getPageCount(); + + Vector numbers = getInvalidPageNumbers(); + for (int i = numbers.size() - 1; i > -1; i--) + removePage( + Integer.parseInt((String) numbers.elementAt(i))); + + try { + printerJob.print(); + } catch (PrinterException e) { + e.printStackTrace(); + throw new IOException("Unable to print: " + + e.getClass().getName() + ": " + e.getMessage()); + } + } + + public void renderPage(Page page) { + pageWidth = (int)((float) page.getWidth() / 1000f); + pageHeight = (int)((float) page.getHeight() / 1000f); + super.renderPage(page); + } + + + private Vector getInvalidPageNumbers() { + + Vector vec = new Vector(); + int max = getPageCount(); + boolean isValid; + for (int i = 0; i < max; i++) { + isValid = true; + if (i < startNumber || i > endNumber) { + isValid = false; + } else if (mode != EVEN_AND_ALL) { + if (mode == EVEN && ((i + 1) % 2 != 0)) + isValid = false; + else if (mode == ODD && ((i + 1) % 2 != 1)) + isValid = false; + } + + if (!isValid) + vec.add(i + ""); + } + + return vec; + } + } // class PrintRenderer + +} + diff --git a/examples/servlet/src/FopServlet.java b/examples/servlet/src/FopServlet.java new file mode 100644 index 000000000..d3043bd9d --- /dev/null +++ b/examples/servlet/src/FopServlet.java @@ -0,0 +1,138 @@ +/* + * $Id$ + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +import java.io.*; + +import javax.servlet.*; +import javax.servlet.http.*; + +import org.xml.sax.InputSource; +import org.xml.sax.XMLReader; + +import org.apache.fop.apps.Driver; +import org.apache.fop.apps.Version; +import org.apache.fop.apps.XSLTInputHandler; +import org.apache.fop.messaging.MessageHandler; + +import org.apache.avalon.framework.logger.ConsoleLogger; +import org.apache.avalon.framework.logger.Logger; + +/** + * Example servlet to generate a PDF from a servlet. + * Servlet param is: + *
    + *
  • fo: the path to a formatting object file to render + *
+ * + * Example URL: http://servername/fop/servlet/FopServlet?fo=readme.fo + * Example URL: http://servername/fop/servlet/FopServlet?xml=data.xml&xsl=format.xsl + * Compiling: you will need + * - servlet_2_2.jar + * - fop.jar + * - sax api + * - avalon-framework-x.jar (where x is the version found the FOP lib dir) + * + * Running: you will need in the WEB-INF/lib/ directory: + * - fop.jar + * - batik.jar + * - xalan-2.0.0.jar + * - avalon-framework-x.jar (where x is the version found the FOP lib dir) + */ +public class FopServlet extends HttpServlet { + public static final String FO_REQUEST_PARAM = "fo"; + public static final String XML_REQUEST_PARAM = "xml"; + public static final String XSL_REQUEST_PARAM = "xsl"; + Logger log = null; + + public void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException { + if (log == null) { + log = new ConsoleLogger(ConsoleLogger.LEVEL_WARN); + MessageHandler.setScreenLogger(log); + } + try { + String foParam = request.getParameter(FO_REQUEST_PARAM); + String xmlParam = request.getParameter(XML_REQUEST_PARAM); + String xslParam = request.getParameter(XSL_REQUEST_PARAM); + + if (foParam != null) { + File fofile = new File(foParam); + //log.warn("FO: "+fofile.getCanonicalPath()); + FileInputStream file = new FileInputStream(fofile); + renderFO(new InputSource(file), response); + } else if ((xmlParam != null) && (xslParam != null)) { + XSLTInputHandler input = + new XSLTInputHandler(new File(xmlParam), + new File(xslParam)); + renderXML(input, response); + } else { + PrintWriter out = response.getWriter(); + out.println("Error\n"+ + "

FopServlet Error

No 'fo' "+ + "request param given."); + } + } catch (ServletException ex) { + throw ex; + } + catch (Exception ex) { + throw new ServletException(ex); + } + } + + /** + * Renders an FO inputsource into a PDF file which is written + * directly to the response object's OutputStream + */ + public void renderFO(InputSource foFile, + HttpServletResponse response) throws ServletException { + try { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + + response.setContentType("application/pdf"); + + Driver driver = new Driver(foFile, out); + driver.setLogger(log); + driver.setRenderer(Driver.RENDER_PDF); + driver.run(); + + byte[] content = out.toByteArray(); + response.setContentLength(content.length); + response.getOutputStream().write(content); + response.getOutputStream().flush(); + } catch (Exception ex) { + throw new ServletException(ex); + } + } + + /** + * 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 + */ + public void renderXML(XSLTInputHandler input, + HttpServletResponse response) throws ServletException { + try { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + + response.setContentType("application/pdf"); + + Driver driver = new Driver(); + driver.setLogger(log); + driver.setRenderer(Driver.RENDER_PDF); + driver.setOutputStream(out); + driver.render(input.getParser(), input.getInputSource()); + + byte[] content = out.toByteArray(); + response.setContentLength(content.length); + response.getOutputStream().write(content); + response.getOutputStream().flush(); + } catch (Exception ex) { + throw new ServletException(ex); + } + } + +} -- 2.39.5