Package org.ametys.web.editor
Class LocalURIResolver
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.cms.transformation.LocalURIResolver
-
- org.ametys.web.editor.LocalURIResolver
-
- All Implemented Interfaces:
URIResolver
,Contextualizable
,LogEnabled
,Serviceable
- Direct Known Subclasses:
NewsletterLocalURIResolver
public class LocalURIResolver extends LocalURIResolver
URIResolver
for type "local". These links or images point to resources local to a rich text.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ametys.cms.transformation.LocalURIResolver
LocalURIResolver.URIInfo
-
-
Field Summary
Fields Modifier and Type Field Description protected URIPrefixHandler
_prefixHandler
theURIPrefixHandler
s-
Fields inherited from class org.ametys.cms.transformation.LocalURIResolver
_ametysObjectResolver, _context
-
-
Constructor Summary
Constructors Constructor Description LocalURIResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
_resolve(String uri, boolean download, boolean absolute, boolean internal, String suffix)
Actually resolves the URI.protected String
_resolve(LocalURIResolver.URIInfo infos, String uri, String siteName, boolean download, boolean absolute, boolean internal, String suffix)
Actually resolves the URI.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.void
service(ServiceManager manager)
-
Methods inherited from class org.ametys.cms.transformation.LocalURIResolver
checkLink, contextualize, getInfos, getLabel, getType, resolveBoundedImageAsBase64, resolveCroppedImage, resolveCroppedImageAsBase64, resolveImageAsBase64, resolveImageAsBase64
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_prefixHandler
protected URIPrefixHandler _prefixHandler
theURIPrefixHandler
s
-
-
Constructor Detail
-
LocalURIResolver
public LocalURIResolver()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classLocalURIResolver
- Throws:
ServiceException
-
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 classLocalURIResolver
- 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.
-
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 classLocalURIResolver
- 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.
-
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 classLocalURIResolver
- 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.
-
_resolve
protected String _resolve(String uri, boolean download, boolean absolute, boolean internal, String suffix)
Actually resolves the URI.- 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.suffix
- a suffix to be appended to the generated path. Should not be null.- Returns:
- the path to the resource.
-
_resolve
protected String _resolve(LocalURIResolver.URIInfo infos, String uri, String siteName, boolean download, boolean absolute, boolean internal, String suffix)
Actually resolves the URI.- Parameters:
infos
- info about parsed uri.uri
- the link URI.siteName
- the siteName, if any.download
- true if the pointed resource is to be downloaded.absolute
- true if the url must be absoluteinternal
- true to get an internal URI.suffix
- a suffix to be appended to the generated path. Should not be null.- Returns:
- the path to the resource.
-
-