How to get all dam assets referred in a page ?

 

At times when you quickly want to retrieve the list of all the assets that have been authored in a page,  it can be an image, pdf, docs you can use this small piece of handy code.  No need to write big and heavy services.

Here it has been shown as a simple class with a method getReferencesInPage(final String pagePath). When you are working on a project you can integrate this with service, servlets, sling model class according to your comfort and need.

Here is the main Asset API which has been used here. It returns a Map object, in case of servlets you can convert this Map objects to any String format , JSON format etc.

 

Leave a Reply

Your email address will not be published. Required fields are marked *