AEM6.4: How do i read properties(or say values) of a resource stored in some 'Xpath' in AEM using Sling Model?



I have a resource stored under in '/libs/settings/wcm/designs/default/jcr:content/main/content/links'.

I need to read the properties(or say values) of that resource using Sling Model?

Accepted Solutions (1)

Accepted Solutions (1)





if you use the design dialog, why don't you use the Designer API, which abstracts this for you.

For example: Design ("The Adobe AEM Quickstart and Web Application.")

(seems that there is some issue with the AEM 6.4 javadoc for this class; I just verified that the API still exists as of AEM 6.4, so you can use it.)

For long-term stability, I would recommend you to consider the new Style system, which is the new way to build templates and components (combined with Editable templates).

Adobe Experience Manager Help | Style System

Answers (4)

Answers (4)




the best approach is to create the apps version and then use the API as described by gauravb10066713​.

If you want to know how to use the sling model in order to get some values into a specific path, this is the snippet that you could use:


public class GetResourceFromPathModel {

   private static final Logger LOG = LoggerFactory.getLogger(GetResourceFromPathModel.class);

   private static final String SERVICENAME = "GETRESOURCESERVICE";

   private ResourceResolverFactory resourceResolverFactory;

   protected void init() {


  ResourceResolver resourceResolver = getResourceResolverBySystemUser(resourceResolverFactory);

  Resource linksResource = resourceResolver.getResource("/libs/settings/wcm/designs/default/jcr:content/main/content/links");




   private ResourceResolver getResourceResolverBySystemUser(ResourceResolverFactory resourceResolverFactory) {

  Map<String, Object> param = new HashMap<String, Object>();

  param.put("sling.service.subservice", SERVICENAME);

  ResourceResolver resolver = null;

   try {

  resolver = resourceResolverFactory.getAdministrativeResourceResolver(param);

  } catch (LoginException e) {

   LOG.error("getResourceResolverBySystemUser: Unable to retrieve resource resolver" , e);


   return resolver;






Create overlay in /apps to manage your design properties and then read it accordingly.

Adobe Experience Manager Help | Common Repository Restructuring in AEM 6.4

Default Designs

Previous location/etc/designs/default
New location(s)



Restructuring guidance

For any Designs that are managed in SCM, and not written to at run-time via Design Dialogs.

  1. Copy the designs from the Previous Location to the New Location (/apps).
  2. Convert any CSS, JavaScript and static resources in the Design to a Client Library with allowProxy = true.
  3. Update references to the Previous Location in the cq:designPath property.
  4. Update any Pages referencing the Previous Location to use the new Client Library category (this requires updating Page implementation code).
  5. Update AEM Dispatcher rules to allow the serving of Client Libraries via the /etc.clientlibs/.. proxy servlet.
For any Designs that NOT managed in SCM, and modified run-time via Design Dialogs.
  • Do not move author-able Designs out of /etc.



Okay I understand.

Actually the path('/libs/settings/wcm/designs/default/jcr:content/main/content/links') is where my Design Dialog values are getting stored. So i need to create a sling model that can read values from that path.




Modifying nodes in /libs is violating best practices, and should only be done when instructed so by Adobe support.

Do you have an existing sling model, which needs to access this data, or do you want to create a new sling model to read the data from there?