Class MediaHandlerConfig
- java.lang.Object
-
- io.wcm.handler.media.spi.MediaHandlerConfig
-
- All Implemented Interfaces:
io.wcm.sling.commons.caservice.ContextAwareService
@ConsumerType public abstract class MediaHandlerConfig extends java.lang.Object implements io.wcm.sling.commons.caservice.ContextAwareService
MediaHandlerConfig
OSGi services provide application-specific configuration for media handling. Applications can set service properties or bundle headers as defined inContextAwareService
to apply this configuration only for resources that match the relevant resource paths.
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_IMAGE_QUALITY
Default image quality for images with lossy compressions (e.g.static double
DEFAULT_JPEG_QUALITY
Deprecated.UseDEFAULT_IMAGE_QUALITY
instead.
-
Constructor Summary
Constructors Constructor Description MediaHandlerConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description @NotNull java.util.Set<java.lang.String>
allowedIpeEditorTypes()
boolean
enforceVirtualRenditions()
Enforce to generate only virtual renditions.@NotNull java.lang.String
getDamRootPath(@NotNull com.day.cq.wcm.api.Page page)
Get root path for picking assets using path field widgets.double
getDefaultImageQuality(@Nullable java.lang.String contentType)
Get the default quality for images.double
getDefaultImageQualityPercentage()
Get the default quality for images.@NotNull java.util.Set<AemRenditionType>
getIncludeAssetAemRenditionsByDefault()
Set of renditions auto-generated by AEM (withcq5dam.
prefix) which are taken into account by default when trying to resolve the media request.@NotNull java.util.List<java.lang.Class<? extends MediaMarkupBuilder>>
getMarkupBuilders()
@NotNull java.lang.String
getMediaAltTextProperty()
@NotNull java.lang.String
getMediaCropProperty()
@NotNull java.lang.String
getMediaForceAltTextFromAssetProperty()
@NotNull java.lang.String
getMediaInlineNodeName()
@NotNull java.lang.String
getMediaIsDecorativeProperty()
@NotNull java.lang.String
getMediaMapProperty()
@NotNull java.lang.String
getMediaRefProperty()
@NotNull java.lang.String
getMediaRotationProperty()
@NotNull java.util.List<java.lang.Class<? extends MediaProcessor>>
getPostProcessors()
@NotNull java.util.List<java.lang.Class<? extends MediaProcessor>>
getPreProcessors()
@NotNull java.util.List<java.lang.Class<? extends MediaSource>>
getSources()
boolean
includeAssetWebRenditionsByDefault()
Deprecated.UsegetIncludeAssetAemRenditionsByDefault()
instead.boolean
useAdobeStandardNames()
With this switch it's possible to switch all used property and node names from (legacy) wcm.io Handler standard to Adobe Standard (as used e.g.
-
-
-
Field Detail
-
DEFAULT_IMAGE_QUALITY
public static final double DEFAULT_IMAGE_QUALITY
Default image quality for images with lossy compressions (e.g. JPEG).- See Also:
- Constant Field Values
-
DEFAULT_JPEG_QUALITY
@Deprecated(since="2.0.0") public static final double DEFAULT_JPEG_QUALITY
Deprecated.UseDEFAULT_IMAGE_QUALITY
instead.Default value for JPEG quality.- See Also:
- Constant Field Values
-
-
Method Detail
-
getSources
@NotNull public @NotNull java.util.List<java.lang.Class<? extends MediaSource>> getSources()
- Returns:
- Supported media sources
-
getMarkupBuilders
@NotNull public @NotNull java.util.List<java.lang.Class<? extends MediaMarkupBuilder>> getMarkupBuilders()
- Returns:
- Available media markup builders
-
getPreProcessors
@NotNull public @NotNull java.util.List<java.lang.Class<? extends MediaProcessor>> getPreProcessors()
- Returns:
- List of media metadata pre processors (optional). The processors are applied in list order.
-
getPostProcessors
@NotNull public @NotNull java.util.List<java.lang.Class<? extends MediaProcessor>> getPostProcessors()
- Returns:
- List of media metadata post processors (optional). The processors are applied in list order.
-
getDefaultImageQuality
public double getDefaultImageQuality(@Nullable @Nullable java.lang.String contentType)
Get the default quality for images. The meaning of the quality parameter for the different image formats is described inLayer.write(String, double, java.io.OutputStream)
.- Parameters:
contentType
- MIME-type of the output format- Returns:
- Quality factor
-
getDefaultImageQualityPercentage
public double getDefaultImageQualityPercentage()
Get the default quality for images. This parameter only applies to images with lossy compression (e.g. JPEG).- Returns:
- Quality percentage (0..1)
-
useAdobeStandardNames
public boolean useAdobeStandardNames()
With this switch it's possible to switch all used property and node names from (legacy) wcm.io Handler standard to Adobe Standard (as used e.g. in Adobe Core WCM Components) - e.g. using "fileReference" instead of property name "mediaRef" for the asset reference.The benefit of the wcm.io Handler standard was that it supported storage multiple asset references in one single node - but this it not well supported by the Touch UI anyway, so it's not of much use nowadays.
For new projects it is recommended to always use the Adobe standard names. But for backward compatibility the default values is false.
- Returns:
- If true, Adobe standard property and node names are used.
-
getMediaRefProperty
@NotNull public @NotNull java.lang.String getMediaRefProperty()
- Returns:
- Default property name for reference to media library item
-
getMediaCropProperty
@NotNull public @NotNull java.lang.String getMediaCropProperty()
- Returns:
- Default property name for cropping parameters
-
getMediaRotationProperty
@NotNull public @NotNull java.lang.String getMediaRotationProperty()
- Returns:
- Default property name for rotate parameter
-
getMediaMapProperty
@NotNull public @NotNull java.lang.String getMediaMapProperty()
- Returns:
- Default property name for map parameter
-
getMediaAltTextProperty
@NotNull public @NotNull java.lang.String getMediaAltTextProperty()
- Returns:
- Default property name for media alt. text
-
getMediaForceAltTextFromAssetProperty
@NotNull public @NotNull java.lang.String getMediaForceAltTextFromAssetProperty()
- Returns:
- Default property name for forcing reading alt. text from DAM asset description
-
getMediaIsDecorativeProperty
@NotNull public @NotNull java.lang.String getMediaIsDecorativeProperty()
- Returns:
- Default property name for marking image as "decorative" - requiring no alt. text
-
getMediaInlineNodeName
@NotNull public @NotNull java.lang.String getMediaInlineNodeName()
- Returns:
- Default node name for inline media item stored in node within the content page
-
includeAssetWebRenditionsByDefault
@Deprecated(since="2.0.0") public boolean includeAssetWebRenditionsByDefault()
Deprecated.UsegetIncludeAssetAemRenditionsByDefault()
instead.- Returns:
- If set to true, web renditions generated by AEM (with
cq5dam.web.
prefix) are taken into account by default when trying to resolve the media request.
-
getIncludeAssetAemRenditionsByDefault
@NotNull public @NotNull java.util.Set<AemRenditionType> getIncludeAssetAemRenditionsByDefault()
Set of renditions auto-generated by AEM (withcq5dam.
prefix) which are taken into account by default when trying to resolve the media request.- Returns:
- Set or rendition types
-
enforceVirtualRenditions
public boolean enforceVirtualRenditions()
Enforce to generate only virtual renditions.By default, virtual renditions (rendered on-the-fly via
ImageFileServet
) are only generated if there is a need to re-scale or crop or transform an image. Otherwise direct references to renditions or original stored in DAM are returned when there is an direct match with the requested ratio and resolution.When this flag is set to
true
, even if there is a direct match a virtual rendition is returned. This ensures that the default quality setting e.g. for JPEG images is always respected, regardless in which quality the original images was uploaded.- Returns:
- Enforce always returning virtual renditions for images.
-
allowedIpeEditorTypes
@NotNull public @NotNull java.util.Set<java.lang.String> allowedIpeEditorTypes()
- Returns:
- Allowed editor types for image IPE (in-place editor). By default, only the OOTB "image" editor type is supported.
-
getDamRootPath
@NotNull public @NotNull java.lang.String getDamRootPath(@NotNull @NotNull com.day.cq.wcm.api.Page page)
Get root path for picking assets using path field widgets.- Parameters:
page
- Context page- Returns:
- DAM root path
-
-