How to download dynamic renditions programmatically | Community
Skip to main content
Level 2
May 3, 2021 7:14 PM UTC
Solved

How to download dynamic renditions programmatically

Hello,

 

I am creating a Java servlet to download assets. If this is static rendition such as cq5dam.web.1280.1280.jpeg, I can call asset method to do that as below:

 

Resource resource = resolver.getResource(assetPath); Asset asset = resource.adaptTo(Asset.class); InputStream is = asset.getRendition("cq5dam.web.1280.1280.jpeg").getStream();

 

But for dynamic rendition, it doesn't work. How can I get stream for dynamic rendition? Your input would be appreciated. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SureshDhulipudi
SureshDhulipudiAccepted solution
New Participant
May 4, 2021 2:39 AM UTC

you can try like this

 

List<Rendition> renditions = asset.getRenditions();
for (Rendition rendition : renditions) {
<<< --- each asset rendition -- get stream >>
}
}

2 replies

SureshDhulipudi
SureshDhulipudiAccepted solution
New Participant
May 4, 2021 2:39 AM UTC

you can try like this

 

List<Rendition> renditions = asset.getRenditions();
for (Rendition rendition : renditions) {
<<< --- each asset rendition -- get stream >>
}
}

Translate
Jam2021Author
Level 2
May 4, 2021 12:31 PM UTC
Yes, I did write a method to list all available renditions but it just shows Static Renditions only.
Translate