How sling identifies relative v/s absolute URL’s in CQ?

I am using version 5.6 of Adobe Experience Manager.

So, you have configured a path in some property in CQ and are not sure how sling is resolving it? Sling resolution in CQ can be checked using Felix console click on the link sling_resouce_resolver to know more.
If you see at the top in Resource Search path, sling resolution precedence is mentioned ( we will discuss it below in detail).

How Sling resolves path (excerpts from Sling documentation) :

  • Absolute or Relative Path Resolution (including search path): The getResource(String path) and getResource(Resource base, String path) methods may be used to access a resource with an absolute path directly. If it can’t be found the path is assumed to be relative and the search path retrieved from getSearchPath() is used to retrieve the resource. This mechanism is similar to resolving a programm with the PATH environment variable in your favourite operating system.

So, if you have mentioned a path like /apps/your_project_name/path/to/resource, Sling will resolve to this path directly, but if you have mentioned a path like your_project/path/to/resource then sling will first look into apps directory and if resource is not resolved then it checks in libs directory. This is driven by Resource Search Path as has been mentioned at the top of the post.

If you create vanity below /etc/maps those URL’s also will also appear in sling_resouce_resolver tab.  If you want to explore more on how resorce resolution happens, you can visit sling documentation here

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s