Package org.ametys.web.editor
Class PageAttachmentURIResolver
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.cms.transformation.AttachmentURIResolver
-
- org.ametys.web.editor.AttachmentURIResolver
-
- org.ametys.web.editor.PageAttachmentURIResolver
-
- All Implemented Interfaces:
URIResolver
,Contextualizable
,LogEnabled
,Serviceable
public class PageAttachmentURIResolver extends AttachmentURIResolver
URIResolver
for type "attachment-page".
These links point to a file from the attachments of the current Page.
-
-
Field Summary
-
Fields inherited from class org.ametys.web.editor.AttachmentURIResolver
_webPrefixHandler
-
Fields inherited from class org.ametys.cms.transformation.AttachmentURIResolver
__PLUGIN_CONTENT_PATTERN, _context, _prefixHandler, _resolver
-
-
Constructor Summary
Constructors Constructor Description PageAttachmentURIResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private String
_getUrl(String uri, boolean download, boolean absolute, boolean internal, String keyword, String addBeforeExtension)
I18nizableText
getLabel(String uri)
Get an URI label.String
getType()
Returns the type of links handled by thisURIResolver
.String
resolve(String uri, boolean download, boolean absolute, boolean internal)
Resolves a link URI for rendering purposes.
The output must be a properly encoded path, relative to the webapp context, accessible from a browser.String
resolveBoundedImage(String uri, int maxHeight, int maxWidth, boolean download, boolean absolute, boolean internal)
Resolves a link URI for rendering image.
The output must be a properly encoded path, relative to the webapp context, accessible from a browser.String
resolveImage(String uri, int height, int width, boolean download, boolean absolute, boolean internal)
Resolves a link URI for rendering image.
The output must be a properly encoded path, relative to the webapp context, accessible from a browser.-
Methods inherited from class org.ametys.web.editor.AttachmentURIResolver
contextualize, getUriPrefix, service
-
Methods inherited from class org.ametys.cms.transformation.AttachmentURIResolver
_resolveImage, checkLink, resolveBoundedImageAsBase64, resolveCroppedImage, resolveCroppedImageAsBase64, resolveImageAsBase64, resolveImageAsBase64
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Constructor Detail
-
PageAttachmentURIResolver
public PageAttachmentURIResolver()
-
-
Method Detail
-
getType
public String getType()
Description copied from interface:URIResolver
Returns the type of links handled by thisURIResolver
.- Specified by:
getType
in interfaceURIResolver
- Overrides:
getType
in classAttachmentURIResolver
- Returns:
- the type of links handled by this
URIResolver
.
-
_getUrl
private String _getUrl(String uri, boolean download, boolean absolute, boolean internal, String keyword, String addBeforeExtension)
-
resolve
public String resolve(String uri, boolean download, boolean absolute, boolean internal)
Description copied from interface:URIResolver
Resolves a link URI for rendering purposes.
The output must be a properly encoded path, relative to the webapp context, accessible from a browser.- Specified by:
resolve
in interfaceURIResolver
- Overrides:
resolve
in classAttachmentURIResolver
- Parameters:
uri
- the link URI.download
- true if the pointed resource is to be downloaded.absolute
- true if the url must be absoluteinternal
- true to get an internal URI.- Returns:
- the path to the resource.
-
resolveBoundedImage
public String resolveBoundedImage(String uri, int maxHeight, int maxWidth, boolean download, boolean absolute, boolean internal)
Description copied from interface:URIResolver
Resolves a link URI for rendering image.
The output must be a properly encoded path, relative to the webapp context, accessible from a browser.- Specified by:
resolveBoundedImage
in interfaceURIResolver
- Overrides:
resolveBoundedImage
in classAttachmentURIResolver
- Parameters:
uri
- the link URI.maxHeight
- the max heightmaxWidth
- the max widthdownload
- true if the pointed resource is to be downloaded.absolute
- true if the url must be absoluteinternal
- true to get an internal URI.- Returns:
- the path to the image.
-
resolveImage
public String resolveImage(String uri, int height, int width, boolean download, boolean absolute, boolean internal)
Description copied from interface:URIResolver
Resolves a link URI for rendering image.
The output must be a properly encoded path, relative to the webapp context, accessible from a browser.- Specified by:
resolveImage
in interfaceURIResolver
- Overrides:
resolveImage
in classAttachmentURIResolver
- Parameters:
uri
- the link URI.height
- the height of the image.width
- the width of the imagedownload
- true if the pointed resource is to be downloaded.absolute
- true if the url must be absoluteinternal
- true to get an internal URI.- Returns:
- the path to the image.
-
getLabel
public I18nizableText getLabel(String uri)
Description copied from interface:URIResolver
Get an URI label.- Specified by:
getLabel
in interfaceURIResolver
- Overrides:
getLabel
in classAttachmentURIResolver
- Parameters:
uri
- the uri which label to get.- Returns:
- the label.
-
-