Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

JSP find instances of a given page/asset

Avatar

Level 2

 I want to be able to, in a JSP, file browse to a page/asset and find all instances of it within my entire AEM instance, so that I can find what uses it.

 

I know this functionality already exists in AEM as when you move a page that is used in a list if informs you that it will modify the list to point to its new location.  How can I access this information in a JSP file efficiently?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Please use this piece of code to get all references of a Asset:

String damPath = "/content/dam/geometrixx/offices/basel kitchen.jpg"; for (ReferenceSearch.Info info: new ReferenceSearch().search(resourceResolver, damPath).values()) { for (String p: info.getProperties()) { out.println("Path is "+info.getPage().getPath()); }

Let me know if you face any issue.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Please use this piece of code to get all references of a Asset:

String damPath = "/content/dam/geometrixx/offices/basel kitchen.jpg"; for (ReferenceSearch.Info info: new ReferenceSearch().search(resourceResolver, damPath).values()) { for (String p: info.getProperties()) { out.println("Path is "+info.getPage().getPath()); }

Let me know if you face any issue.