Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

How to download dynamic renditions programmatically

jamesc25111500
Level 1
Level 1

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. 

download dynamic renditions
1 Accepted Solution
SureshDhulipudi
Correct answer by
Community Advisor
Community Advisor

you can try like this

 

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

View solution in original post

2 Replies
SureshDhulipudi
Correct answer by
Community Advisor
Community Advisor

you can try like this

 

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

View solution in original post

jamesc25111500
Level 1
Level 1
Yes, I did write a method to list all available renditions but it just shows Static Renditions only.