Class ResolveURIComponent
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.cms.transformation.xslt.ResolveURIComponent
- All Implemented Interfaces:
Initializable
,Contextualizable
,LogEnabled
,Serviceable
public class ResolveURIComponent
extends AbstractLogEnabled
implements Serviceable, Initializable, Contextualizable
This component resolve links and give a static hack access for xslt calls
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
contextualize
(Context context) static String
getMimeType
(String type, String uri) Get the mime type.void
static String
Resolve an uri upon the LinkResolverExtensionPointstatic String
Resolve an uri upon the LinkResolverExtensionPointstatic String
Resolve an uri upon the LinkResolverExtensionPointstatic String
Resolve an uri upon the LinkResolverExtensionPointstatic String
resolveBoundedImage
(String type, String uri, int maxHeight, int maxWidth) Resolve an uri upon the LinkResolverExtensionPointstatic String
resolveBoundedImage
(String type, String uri, int maxHeight, int maxWidth, boolean download) Resolve an uri upon the LinkResolverExtensionPointstatic String
resolveBoundedImage
(String type, String uri, int maxHeight, int maxWidth, boolean download, boolean absolute) Resolve an uri upon the LinkResolverExtensionPointstatic String
resolveBoundedImage
(String type, String uri, int maxHeight, int maxWidth, boolean download, boolean absolute, boolean internal) Resolve an uri upon the LinkResolverExtensionPointstatic String
resolveBoundedImageAsBase64
(String type, String uri, int maxHeight, int maxWidth) Resolve an uri upon the LinkResolverExtensionPoint return it as a base64-encoded string.static String
resolveCroppedImage
(String type, String uri, int cropHeight, int cropWidth) Resolve an uri upon the LinkResolverExtensionPointstatic String
resolveCroppedImage
(String type, String uri, int cropHeight, int cropWidth, boolean download) Resolve an uri upon the LinkResolverExtensionPointstatic String
resolveCroppedImage
(String type, String uri, int cropHeight, int cropWidth, boolean download, boolean absolute) Resolve an uri upon the LinkResolverExtensionPointstatic String
resolveCroppedImage
(String type, String uri, int cropHeight, int cropWidth, boolean download, boolean absolute, boolean internal) Resolve an uri upon the LinkResolverExtensionPointstatic String
resolveCroppedImageAsBase64
(String type, String uri, int cropHeight, int cropWidth) Resolve an uri upon the LinkResolverExtensionPoint return it as a base64-encoded string.static String
resolveImage
(String type, String uri, int height, int width) Resolve an uri upon the LinkResolverExtensionPointstatic String
resolveImage
(String type, String uri, int height, int width, boolean download) Resolve an uri upon the LinkResolverExtensionPointstatic String
resolveImage
(String type, String uri, int height, int width, boolean download, boolean absolute) Resolve an uri upon the LinkResolverExtensionPointstatic String
resolveImage
(String type, String uri, int height, int width, boolean download, boolean absolute, boolean internal) Resolve an uri upon the LinkResolverExtensionPointstatic String
resolveImageAsBase64
(String type, String uri, int height, int width) Resolve an uri upon the LinkResolverExtensionPoint return it as a base64-encoded string.void
service
(ServiceManager manager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Constructor Details
-
ResolveURIComponent
public ResolveURIComponent()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
resolve
Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the type- Returns:
- The uri resolved, or the uri if there is no resolver adapted
-
resolve
Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typedownload
- Is this uri for download purposes.- Returns:
- The uri resolved, or the uri if there is no resolver adapted
-
resolve
Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typedownload
- Is this uri for download purposes.absolute
- true to generate absolute url- Returns:
- The uri resolved, the empty string if the uri could not be resolved, or the uri itself if there is no resolver adapted
-
resolve
public static String resolve(String type, String uri, boolean download, boolean absolute, boolean internal) Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typedownload
- Is this uri for download purposes.absolute
- true to generate absolute urlinternal
- true to get an internal URI.- Returns:
- The uri resolved, the empty string if the uri could not be resolved, or the uri itself if there is no resolver adapted
-
resolveImage
Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typeheight
- the heightwidth
- the width- Returns:
- The uri resolved, or the uri if there is no resolver adapted
-
resolveImage
Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typeheight
- the heightwidth
- the widthdownload
- Is this uri for download purposes.- Returns:
- The uri resolved, or the uri if there is no resolver adapted
-
resolveImage
public static String resolveImage(String type, String uri, int height, int width, boolean download, boolean absolute) Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typeheight
- the heightwidth
- the widthdownload
- Is this uri for download purposes.absolute
- true to generate absolute url- Returns:
- The uri resolved, the empty string if the uri could not be resolved, or the uri itself if there is no resolver adapted
-
resolveImage
public static String resolveImage(String type, String uri, int height, int width, boolean download, boolean absolute, boolean internal) Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typeheight
- the heightwidth
- the widthdownload
- Is this uri for download purposes.absolute
- true to generate absolute urlinternal
- true to get an internal URI.- Returns:
- The uri resolved, the empty string if the uri could not be resolved, or the uri itself if there is no resolver adapted
-
resolveImageAsBase64
Resolve an uri upon the LinkResolverExtensionPoint return it as a base64-encoded string.- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typeheight
- the heightwidth
- the width- Returns:
- a base64-encoded string representing the image or empty string if the uri could not be resolved, or the uri itself if there is no resolver adapted
-
resolveBoundedImage
Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typemaxHeight
- the max heightmaxWidth
- the max width- Returns:
- The uri resolved, or the uri if there is no resolver adapted
-
resolveBoundedImage
public static String resolveBoundedImage(String type, String uri, int maxHeight, int maxWidth, boolean download) Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typemaxHeight
- the max heightmaxWidth
- the max widthdownload
- Is this uri for download purposes.- Returns:
- The uri resolved, or the uri if there is no resolver adapted
-
resolveBoundedImage
public static String resolveBoundedImage(String type, String uri, int maxHeight, int maxWidth, boolean download, boolean absolute) Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typemaxHeight
- the max heightmaxWidth
- the max widthdownload
- Is this uri for download purposes.absolute
- true to generate absolute url- Returns:
- The uri resolved, the empty string if the uri could not be resolved, or the uri itself if there is no resolver adapted
-
resolveBoundedImage
public static String resolveBoundedImage(String type, String uri, int maxHeight, int maxWidth, boolean download, boolean absolute, boolean internal) Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typemaxHeight
- the max heightmaxWidth
- the max widthdownload
- Is this uri for download purposes.absolute
- true to generate absolute urlinternal
- true to get an internal URI.- Returns:
- The uri resolved, the empty string if the uri could not be resolved, or the uri itself if there is no resolver adapted
-
resolveBoundedImageAsBase64
public static String resolveBoundedImageAsBase64(String type, String uri, int maxHeight, int maxWidth) Resolve an uri upon the LinkResolverExtensionPoint return it as a base64-encoded string.- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typemaxHeight
- the max heightmaxWidth
- the max width- Returns:
- a base64-encoded string representing the image or empty string if the uri could not be resolved, or the uri itself if there is no resolver adapted
-
resolveCroppedImage
Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typecropHeight
- the crop heightcropWidth
- the crop width- Returns:
- The uri resolved, or the uri if there is no resolver adapted
-
resolveCroppedImage
public static String resolveCroppedImage(String type, String uri, int cropHeight, int cropWidth, boolean download) Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typecropHeight
- the crop heightcropWidth
- the crop widthdownload
- Is this uri for download purposes.- Returns:
- The uri resolved, or the uri if there is no resolver adapted
-
resolveCroppedImage
public static String resolveCroppedImage(String type, String uri, int cropHeight, int cropWidth, boolean download, boolean absolute) Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typecropHeight
- the crop heightcropWidth
- the crop widthdownload
- Is this uri for download purposes.absolute
- true to generate absolute url- Returns:
- The uri resolved, the empty string if the uri could not be resolved, or the uri itself if there is no resolver adapted
-
resolveCroppedImage
public static String resolveCroppedImage(String type, String uri, int cropHeight, int cropWidth, boolean download, boolean absolute, boolean internal) Resolve an uri upon the LinkResolverExtensionPoint- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typecropHeight
- the crop heightcropWidth
- the crop widthdownload
- Is this uri for download purposes.absolute
- true to generate absolute urlinternal
- true to get an internal URI.- Returns:
- The uri resolved, the empty string if the uri could not be resolved, or the uri itself if there is no resolver adapted
-
resolveCroppedImageAsBase64
public static String resolveCroppedImageAsBase64(String type, String uri, int cropHeight, int cropWidth) Resolve an uri upon the LinkResolverExtensionPoint return it as a base64-encoded string.- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the typecropHeight
- the crop heightcropWidth
- the crop width- Returns:
- a base64-encoded string representing the image or empty string if the uri could not be resolved, or the uri itself if there is no resolver adapted
-
getMimeType
Get the mime type.- Parameters:
type
- Type name (defined by the extension to use)uri
- URI depending on the type- Returns:
- the mime type or application/octet-stream if not found
-