How to download dynamic renditions programmatically | Community
Skip to main content
Level 2
May 3, 2021
Solved

How to download dynamic renditions programmatically

  • May 3, 2021
  • 1 reply
  • 1194 views

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.
Best answer by SureshDhulipudi

you can try like this

 

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

1 reply

SureshDhulipudi
Community Advisor
SureshDhulipudiCommunity AdvisorAccepted solution
Community Advisor
May 4, 2021

you can try like this

 

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

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