Reputation: 826
I have been poking around the Internet for some time looking for more information on configuring Sling Resource Resolver mappings. From what I found online and my experience there are currently two methods accomplishing this in AEM.
The Sling documentation on Mappings for Resource Resolution and the AEM documentation on Resource Mapping both seem to suggest that using the method (2) that makes use of the property resource.resolver.map.location is the recommended way given that it is the only method explained by the documentations.
I'd love to clear this up and gain a better understanding on this topic. I think most of the online resources on this subject lack of depth in explaining the differences in both methods and the benefits in using one versus the other. More detailed insight, explanations and practical illustrations on this topic are highly welcomed.
Thanks
Upvotes: 3
Views: 3112
Reputation: 1728
I also can't give an answer. But if you look into the code at MapEntries#doUpdateConfiguration
(line 428), then you can see that the following entries are finally merged into the same internal lookup-map. So technically there is no difference.
resource.resolver.virtual
resource.resolver.mapping
resource.resolver.map.location
My Understanding
In my understanding at least since Day CQ 5 the recommended way is to use resource.resolver.map.location
. It is the most flexible way. The others are probably still there for historic reasons.
Large Multi-Brand / Multi-Teams Projects
Another good reason for /etc/map
is, that large projects with multiple teams and brands have to avoid global OSGi configs (have something like Unilever in mind). Therefore many other OSGi configs have also an alternative way to configure it:
In such cases always prefer the variant, which allows multiple teams to independently provide their part of the config. In your case the teams could provide different sub-trees under /etc/map
PS: I'm even not sure, if regex are working in the OSGi configs. This speaks for /etc/maps
too.
Upvotes: 3