Class MediaHandlerConfig

  • All Implemented Interfaces:
    io.wcm.sling.commons.caservice.ContextAwareService

    @ConsumerType
    public abstract class MediaHandlerConfig
    extends 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 in ContextAwareService to apply this configuration only for resources that match the relevant resource paths.
    • Field Detail

      • DEFAULT_JPEG_QUALITY

        public static final double DEFAULT_JPEG_QUALITY
        Default value for JPEG quality.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MediaHandlerConfig

        public MediaHandlerConfig()
    • Method Detail

      • getSources

        @NotNull
        public @NotNull List<Class<? extends MediaSource>> getSources()
        Returns:
        Supported media sources
      • getMarkupBuilders

        @NotNull
        public @NotNull List<Class<? extends MediaMarkupBuilder>> getMarkupBuilders()
        Returns:
        Available media markup builders
      • getPreProcessors

        @NotNull
        public @NotNull List<Class<? extends MediaProcessor>> getPreProcessors()
        Returns:
        List of media metadata pre processors (optional). The processors are applied in list order.
      • getPostProcessors

        @NotNull
        public @NotNull List<Class<? extends MediaProcessor>> getPostProcessors()
        Returns:
        List of media metadata post processors (optional). The processors are applied in list order.
      • getDefaultImageQuality

        public double getDefaultImageQuality​(String mimeType)
        Get the default quality for images in this app generated with the Layer API. The meaning of the quality parameter for the different image formats is described in Layer.write(String, double, java.io.OutputStream).
        Parameters:
        mimeType - MIME-type of the output format
        Returns:
        Quality factor
      • 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 String getMediaRefProperty()
        Returns:
        Default property name for reference to media library item
      • getMediaCropProperty

        @NotNull
        public @NotNull String getMediaCropProperty()
        Returns:
        Default property name for cropping parameters
      • getMediaRotationProperty

        @NotNull
        public @NotNull String getMediaRotationProperty()
        Returns:
        Default property name for rotate parameter
      • getMediaMapProperty

        @NotNull
        public @NotNull String getMediaMapProperty()
        Returns:
        Default property name for map parameter
      • getMediaAltTextProperty

        @NotNull
        public @NotNull String getMediaAltTextProperty()
        Returns:
        Default property name for media alt. text
      • getMediaInlineNodeName

        @NotNull
        public @NotNull String getMediaInlineNodeName()
        Returns:
        Default node name for inline media item stored in node within the content page
      • includeAssetWebRenditionsByDefault

        public boolean includeAssetWebRenditionsByDefault()
        Returns:
        If set to true, web renditions generated by the DAM asset workflows (with cq5dam.web prefix) are taken into account by default when trying to resolve the media request.
      • getDamRootPath

        @NotNull
        public @NotNull 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