April 3, 2020
Estimated Post Reading Time ~

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 the 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 the 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 program with the PATH environment variable in your favorite 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 the resource is not resolved then it checks in the 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 URLs also will also appear in the sling_resouce_resolver tab. If you want to explore more on how resource resolution happens, you can visit sling documentation here




By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.