Package org.opencms.pdftools
Class CmsPdfResourceHandler
java.lang.Object
org.opencms.pdftools.CmsPdfResourceHandler
- All Implemented Interfaces:
I_CmsResourceInit
This resource handler handles URLs of the form /pdflink/{locale}/{formatter-id}/{detailname} and format
the content identified by detailname using the JSP identified by formatter-id to generate XHTML which is then
converted to PDF and returned directly by this handler.
In Online mode, the generated PDFs are cached on the real file system, while in Offline mode, the PDF data is always generated on-the-fly.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Mime type data for different file extensions.Map of mime types for different file extensions.Fields inherited from interface org.opencms.main.I_CmsResourceInit
ATTR_ALTERNATIVE_CMS_OBJECT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
handlePdfLink
(CmsObject cms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uri) Handles a link for generating a PDF.initResource
(CmsResource resource, CmsObject cms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Possibility to modify or change the CmsFile with the CmsObject.protected void
logXhtmlOutput
(CmsResource formatter, CmsResource content, byte[] xhtmlData) Logs the XHTML output.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opencms.main.I_CmsResourceInit
getConfiguration, initParameters
-
Field Details
-
IMAGE_MIMETYPECONFIG
Mime type data for different file extensions.- See Also:
-
IMAGE_MIMETYPES
Map of mime types for different file extensions.
-
-
Constructor Details
-
CmsPdfResourceHandler
public CmsPdfResourceHandler()Creates a new instance.
-
-
Method Details
-
initResource
public CmsResource initResource(CmsResource resource, CmsObject cms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws CmsResourceInitException, CmsSecurityException Description copied from interface:I_CmsResourceInit
Possibility to modify or change the CmsFile with the CmsObject.Caution: reading parameters from the request, destroys special characters in all parameters, because the encoding for the request was not set yet.
- Specified by:
initResource
in interfaceI_CmsResourceInit
- Parameters:
resource
- the requested filecms
- the current CmsObjectrequest
- the current requestresponse
- the current response- Returns:
- a resource in the OpenCms VFS
- Throws:
CmsResourceInitException
- if other implementations of the interface should not be executedCmsSecurityException
- if other implementations of the interface should not be executed, and the security exception should be escalated- See Also:
-
handlePdfLink
protected void handlePdfLink(CmsObject cms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uri) throws Exception Handles a link for generating a PDF.- Parameters:
cms
- the current CMS contextrequest
- the servlet requestresponse
- the servlet responseuri
- the current uri- Throws:
Exception
- if something goes wrongCmsResourceInitException
- if the resource initialization is cancelled
-
logXhtmlOutput
Logs the XHTML output.- Parameters:
formatter
- the formattercontent
- the content resourcexhtmlData
- the XHTML data
-