public class FopServlet
extends javax.servlet.http.HttpServlet
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
FO_REQUEST_PARAM
Name of the parameter used for the XSL-FO file
|
protected FopFactory |
fopFactory
The FopFactory used to create Fop instances
|
protected javax.xml.transform.TransformerFactory |
transFactory
The TransformerFactory used to create Transformer instances
|
protected javax.xml.transform.URIResolver |
uriResolver
URIResolver for use by this servlet
|
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 and Description |
---|
FopServlet() |
Modifier and Type | Method and Description |
---|---|
protected void |
configureFopFactory(FopFactoryBuilder builder)
This method is called right after the FopFactory is instantiated and can be overridden
by subclasses to perform additional configuration.
|
protected javax.xml.transform.Source |
convertString2Source(java.lang.String param)
Converts a String parameter to a JAXP Source object.
|
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected FOUserAgent |
getFOUserAgent() |
void |
init() |
protected void |
render(javax.xml.transform.Source src,
javax.xml.transform.Transformer transformer,
javax.servlet.http.HttpServletResponse response)
Renders an input file (XML or XSL-FO) into a PDF file.
|
protected void |
renderFO(java.lang.String fo,
javax.servlet.http.HttpServletResponse response)
Renders an XSL-FO file into a PDF file.
|
protected void |
renderXML(java.lang.String xml,
java.lang.String xslt,
javax.servlet.http.HttpServletResponse response)
Renders an XML file into a PDF file by applying a stylesheet
that converts the XML to XSL-FO.
|
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
protected static final java.lang.String FO_REQUEST_PARAM
protected static final java.lang.String XML_REQUEST_PARAM
protected static final java.lang.String XSLT_REQUEST_PARAM
protected javax.xml.transform.TransformerFactory transFactory
protected FopFactory fopFactory
protected transient javax.xml.transform.URIResolver uriResolver
public void init() throws javax.servlet.ServletException
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
protected void configureFopFactory(FopFactoryBuilder builder)
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException
doGet
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
protected javax.xml.transform.Source convertString2Source(java.lang.String param)
param
- a String parameterprotected void renderFO(java.lang.String fo, javax.servlet.http.HttpServletResponse response) throws FOPException, javax.xml.transform.TransformerException, java.io.IOException
fo
- the XSL-FO fileresponse
- HTTP response objectFOPException
- If an error occurs during the rendering of the
XSL-FOjavax.xml.transform.TransformerException
- If an error occurs while parsing the input
filejava.io.IOException
- In case of an I/O problemprotected void renderXML(java.lang.String xml, java.lang.String xslt, javax.servlet.http.HttpServletResponse response) throws FOPException, javax.xml.transform.TransformerException, java.io.IOException
xml
- the XML filexslt
- the XSLT fileresponse
- HTTP response objectFOPException
- If an error occurs during the rendering of the
XSL-FOjavax.xml.transform.TransformerException
- If an error occurs during XSL
transformationjava.io.IOException
- In case of an I/O problemprotected void render(javax.xml.transform.Source src, javax.xml.transform.Transformer transformer, javax.servlet.http.HttpServletResponse response) throws FOPException, javax.xml.transform.TransformerException, java.io.IOException
src
- Input XML or XSL-FOtransformer
- Transformer to use for optional transformationresponse
- HTTP response objectFOPException
- If an error occurs during the rendering of the
XSL-FOjavax.xml.transform.TransformerException
- If an error occurs during XSL
transformationjava.io.IOException
- In case of an I/O problemprotected FOUserAgent getFOUserAgent()
Copyright 1999-2017 The Apache Software Foundation. All Rights Reserved.