Package com.day.cq.wcm.foundation
Class WCMRenditionPicker
java.lang.Object
com.day.cq.wcm.foundation.WCMRenditionPicker
- All Implemented Interfaces:
RenditionPicker
The
WCMRenditionPicker searches first the web rendition starting
with "cq5dam.web.". If no web rendition exists the current original
is returned.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetRendition(Asset asset) Returns the desired renditionRenditionif existing, otherwisenull.
-
Constructor Details
-
WCMRenditionPicker
public WCMRenditionPicker()
-
-
Method Details
-
getRendition
Description copied from interface:RenditionPickerReturns the desired renditionRenditionif existing, otherwisenull.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(); } ...- Specified by:
getRenditionin interfaceRenditionPicker- Parameters:
asset- TheAssetwithin which to search the rendition.- Returns:
- the desired rendition if existing, otherwise
null
-