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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to download dynamic renditions programmatically

Avatar

Level 2

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. 

1 Accepted Solution

Avatar

Correct answer by
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

Avatar

Correct answer by
Community Advisor

you can try like this

 

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

Avatar

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