Interface RenditionPicker

All Known Implementing Classes:
PrefixRenditionPicker, Scene7PresetRenditionPicker, WCMRenditionPicker

public interface RenditionPicker
The RenditionPicker interface specifies retrieving an arbitrary asset rendition via custom implementations.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the desired rendition Rendition if existing, otherwise null.
  • Method Details

    • getRendition

      Rendition getRendition(Asset asset)
      Returns the desired rendition Rendition if existing, otherwise null.

      Implementations are free to decide which rendition is chosen when this method is called.

      The rendition shall be searched for within the given Asset.

      Example implementation:

        ...
        public Resource getRendition(Asset asset) {
            // 1. try to get a web enabled rendition
            List<Resource> renditions = asset.getRenditions();
            for (Resource rendition: renditions) {
                if (Text.getName(rendition.getPath()).startsWith("cq5dam.web.")) {
                    return rendition;
                }
            }
            // 2. return current rendition
            return asset.getCurrentOriginal();
        }
        ...
       
      Parameters:
      asset - The Asset within which to search the rendition.
      Returns:
      the desired rendition if existing, otherwise null