Accepted Solutions (1)

Accepted Solutions (1)

Umesh_Sondhi

MVP

23-09-2019

Resource Collection API will be used to retrieve the assets in a Collection. For reference

Resource resource = resourceResolver

            .getResource("yourpath");

    if (null != resource) {

        log.debug("resource path is {}", resource.getPath());

        ResourceCollection resourceCollection = resource.adaptTo(ResourceCollection.class);

        if (null != resourceCollection) {

            Iterator<Resource> resourceIterator = resourceCollection.getResources();

            while (resourceIterator.hasNext()) {

                Resource damResource = resourceIterator.next();

                log.debug("damResource path is {}", damResource.getPath());

                imagePaths.add(damResource.getPath());

            }

        }

    }