org.foray.demo.servlet
Class DemoServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.foray.demo.servlet.AbstractDemoServlet
org.foray.demo.servlet.DemoServlet
- All Implemented Interfaces:
- Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
public class DemoServlet
- extends AbstractDemoServlet
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/foray/servlet/DemopServlet?fo=readme.fo
Example URL:
http://servername/foray/servlet/DemoServlet?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
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 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 |
DemoServlet
public DemoServlet()
- Constructor.
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.