public class FopServlet
extends jakarta.servlet.http.HttpServlet
Modifier and Type | Field and Description |
---|---|
protected static 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 TransformerFactory |
transFactory
The TransformerFactory used to create Transformer instances
|
protected URIResolver |
uriResolver
URIResolver for use by this servlet
|
protected static String |
XML_REQUEST_PARAM
Name of the parameter used for the XML file
|
protected static 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 Source |
convertString2Source(String param)
Converts a String parameter to a JAXP Source object.
|
void |
doGet(jakarta.servlet.http.HttpServletRequest request,
jakarta.servlet.http.HttpServletResponse response) |
protected FOUserAgent |
getFOUserAgent() |
void |
init() |
protected void |
render(Source src,
Transformer transformer,
jakarta.servlet.http.HttpServletResponse response)
Renders an input file (XML or XSL-FO) into a PDF file.
|
protected void |
renderFO(String fo,
jakarta.servlet.http.HttpServletResponse response)
Renders an XSL-FO file into a PDF file.
|
protected void |
renderXML(String xml,
String xslt,
jakarta.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 String FO_REQUEST_PARAM
protected static final String XML_REQUEST_PARAM
protected static final String XSLT_REQUEST_PARAM
protected TransformerFactory transFactory
protected FopFactory fopFactory
protected transient URIResolver uriResolver
public void init() throws jakarta.servlet.ServletException
init
in class jakarta.servlet.GenericServlet
jakarta.servlet.ServletException
protected void configureFopFactory(FopFactoryBuilder builder)
public void doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException
doGet
in class jakarta.servlet.http.HttpServlet
jakarta.servlet.ServletException
protected Source convertString2Source(String param)
param
- a String parameterprotected void renderFO(String fo, jakarta.servlet.http.HttpServletResponse response) throws FOPException, TransformerException, IOException
fo
- the XSL-FO fileresponse
- HTTP response objectFOPException
- If an error occurs during the rendering of the
XSL-FOTransformerException
- If an error occurs while parsing the input
fileIOException
- In case of an I/O problemprotected void renderXML(String xml, String xslt, jakarta.servlet.http.HttpServletResponse response) throws FOPException, TransformerException, IOException
xml
- the XML filexslt
- the XSLT fileresponse
- HTTP response objectFOPException
- If an error occurs during the rendering of the
XSL-FOTransformerException
- If an error occurs during XSL
transformationIOException
- In case of an I/O problemprotected void render(Source src, Transformer transformer, jakarta.servlet.http.HttpServletResponse response) throws FOPException, TransformerException, 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-FOTransformerException
- If an error occurs during XSL
transformationIOException
- In case of an I/O problemprotected FOUserAgent getFOUserAgent()
Copyright © 2025 Apache Software Foundation. All rights reserved.