public class WCMRenditionPicker extends java.lang.Object implements RenditionPicker
WCMRenditionPicker searches first the web rendition starting
with "cq5dam.web.". If no web rendition exists the current original
is returned.| Constructor and Description |
|---|
WCMRenditionPicker() |
| Modifier and Type | Method and Description |
|---|---|
Rendition |
getRendition(Asset asset)
Returns the desired rendition
Rendition if existing, otherwise null. |
public Rendition getRendition(Asset asset)
RenditionPickerRendition 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();
}
...
getRendition in interface RenditionPickerasset - The Asset within which to search the rendition.nullCopyright © 2010 - 2023 Adobe. All Rights Reserved