|
fop 0.95 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.fop.servlet.FopServlet
Example servlet to generate a PDF from a servlet.
Servlet param is:
Field Summary | |
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 org.apache.commons.logging.impl.SimpleLog |
log
Logger to give to FOP |
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 Summary | |
FopServlet()
|
Method Summary | |
protected void |
configureFopFactory()
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. |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doOptions, doPost, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
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 org.apache.commons.logging.impl.SimpleLog log
protected javax.xml.transform.TransformerFactory transFactory
protected FopFactory fopFactory
protected javax.xml.transform.URIResolver uriResolver
Constructor Detail |
public FopServlet()
Method Detail |
public void init() throws javax.servlet.ServletException
javax.servlet.ServletException
protected void configureFopFactory()
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException
javax.servlet.ServletException
protected javax.xml.transform.Source convertString2Source(java.lang.String param)
param
- a String parameter
protected 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 object
FOPException
- If an error occurs during the rendering of the
XSL-FO
javax.xml.transform.TransformerException
- If an error occurs while parsing the input
file
java.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 object
FOPException
- If an error occurs during the rendering of the
XSL-FO
javax.xml.transform.TransformerException
- If an error occurs during XSL
transformation
java.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 object
FOPException
- If an error occurs during the rendering of the
XSL-FO
javax.xml.transform.TransformerException
- If an error occurs during XSL
transformation
java.io.IOException
- In case of an I/O problemprotected FOUserAgent getFOUserAgent()
|
fop 0.95 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |