Package org.opencms.pdftools
Class CmsPdfLink
- java.lang.Object
-
- org.opencms.pdftools.CmsPdfLink
-
public class CmsPdfLink extends java.lang.Object
This class is responsbile for creating and parsing links to generated PDFs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CmsPdfLink.CmsPdfLinkParseException
Exception which is thrown when parsing a link as a PDF link fails.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NOSLASH_GROUP
Group of characters without slashes.static java.lang.String
PDF_LINK_PREFIX
The prefix string for PDF links.static java.lang.String
PDF_LINK_REGEX
Regular expression for parsing PDF links.static java.util.regex.Pattern
PDF_LINK_REGEX_COMPILED
Compiled regular expression for parsing PDF links.
-
Constructor Summary
Constructors Constructor Description CmsPdfLink(CmsObject cms, java.lang.String link)
Creates a PDF link object by parsing it from a link string.CmsPdfLink(CmsObject cms, CmsResource formatter, CmsResource content, java.lang.String filename)
Creates a new PDF link object based on the formatter and content resources and the locale of the current CMS context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CmsResource
getContent()
Returns the content.CmsResource
getFormatter()
Gets the formatter resource.java.lang.String
getLink()
Returns the link.java.util.Locale
getLocale()
Returns the locale.
-
-
-
Field Detail
-
NOSLASH_GROUP
public static final java.lang.String NOSLASH_GROUP
Group of characters without slashes.- See Also:
- Constant Field Values
-
PDF_LINK_PREFIX
public static final java.lang.String PDF_LINK_PREFIX
The prefix string for PDF links.- See Also:
- Constant Field Values
-
PDF_LINK_REGEX
public static final java.lang.String PDF_LINK_REGEX
Regular expression for parsing PDF links.- See Also:
- Constant Field Values
-
PDF_LINK_REGEX_COMPILED
public static final java.util.regex.Pattern PDF_LINK_REGEX_COMPILED
Compiled regular expression for parsing PDF links.
-
-
Constructor Detail
-
CmsPdfLink
public CmsPdfLink(CmsObject cms, CmsResource formatter, CmsResource content, java.lang.String filename) throws CmsException
Creates a new PDF link object based on the formatter and content resources and the locale of the current CMS context.- Parameters:
cms
- the current CMS contextformatter
- the formatter resourcecontent
- the content resourcefilename
- the file name to use for the PDF download link- Throws:
CmsException
- if something goes wrong
-
CmsPdfLink
public CmsPdfLink(CmsObject cms, java.lang.String link) throws CmsPdfLink.CmsPdfLinkParseException, CmsException
Creates a PDF link object by parsing it from a link string.- Parameters:
cms
- the current CMS contextlink
- the link as a string- Throws:
CmsPdfLink.CmsPdfLinkParseException
- if the given link is not a PDF linkCmsException
- if something else goes wrong
-
-
Method Detail
-
getContent
public CmsResource getContent()
Returns the content.- Returns:
- the content
-
getFormatter
public CmsResource getFormatter()
Gets the formatter resource.- Returns:
- the formatter resource
-
getLink
public java.lang.String getLink()
Returns the link.- Returns:
- the link
-
getLocale
public java.util.Locale getLocale()
Returns the locale.- Returns:
- the locale
-
-