Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Configure Sling Mapping for Resource Resolution in Adobe Experience Manager — Deep Dive

This tutorial explains the complete details on configuring sling mapping for resource resolution in Adobe Experience Manager.

Resource mapping is used to define the content mapping and redirects in AEM.

I have enabled two sample domains "); background-position: 0px calc(1em + 1px); background-repeat: repeat-x; background-size: 1px 1px; box-sizing: inherit; text-decoration-line: none;' target="_blank">www.example1.com and "); background-position: 0px calc(1em + 1px); background-repeat: repeat-x; background-size: 1px 1px; box-sizing: inherit; text-decoration-line: none;' target="_blank">www.example2.com pointing to /content/wknd/us/en and /content/wknd/ca/en nodes respectively(sample wknd website nodes).

The flow is as below

The user request for "); background-position: 0px calc(1em + 1px); background-repeat: repeat-x; background-size: 1px 1px; box-sizing: inherit; text-decoration-line: none;' target="_blank">www.example1.com and "); background-position: 0px calc(1em + 1px); background-repeat: repeat-x; background-size: 1px 1px; box-sizing: inherit; text-decoration-line: none;' target="_blank">www.example2.com, the Apache redirects the user to the domain specific landing pages and also redirect the user to the shortened URL(hide/content/wknd/ if user access the page with full content path). The dispatcher pass through the shortened content URL’s to publisher by appending the full content path /content/wknd/

As first step let us enable the virtual host configurations for "); background-position: 0px calc(1em + 1px); background-repeat: repeat-x; background-size: 1px 1px; box-sizing: inherit; text-decoration-line: none;' target="_blank">www.example1.com and "); background-position: 0px calc(1em + 1px); background-repeat: repeat-x; background-size: 1px 1px; box-sizing: inherit; text-decoration-line: none;' target="_blank">www.example2.com in Apache(Dispatcher)

“DispatcherUseProcessedURL on” configuration should be enabled in dispatcher configuration to enable the Pass Through URL’s to work

e.g

Now both the domains "); background-position: 0px calc(1em + 1px); background-repeat: repeat-x; background-size: 1px 1px; box-sizing: inherit; text-decoration-line: none;' target="_blank">www.example1.com and "); background-position: 0px calc(1em + 1px); background-repeat: repeat-x; background-size: 1px 1px; box-sizing: inherit; text-decoration-line: none;' target="_blank">www.example2.com are accessible, this will display the mapped landing page content but the internal page links still point to the complete URL(/content/wknd/>)

Let us now enable the run mode specific(my case the server is enabled with additional run mode “dev”) ResourceResolver configuration — “Apache Sling Resource Resolver Factory” to reverse map the internal full content path to the shortened URL— enable the mapping for all the required content paths.

Now the internal page links are transformed to shortened URL based on the URL mappings in the Resource Resolver.

This approach has multiple draw backs —

  • the mapping don’t supports the regex expressions
  • it doesn’t support cross-site links because this rewriting method is not domain-aware
  • reverse map the content path to the corresponding domain wont work

The incoming URL will be resolved without any issue as the dispatcher always send the complete path(e.g /content/wknd/us/en.html) to the publisher — "); background-position: 0px calc(1em + 1px); background-repeat: repeat-x; background-size: 1px 1px; box-sizing: inherit; text-decoration-line: none;' target="_blank">http://localhost:4503/system/console/jcrresolver.

The content path is not reversed mapped to the domain URL

This will create issues while supporting multiple domains in the AEM platform and need to link the pages between sites(the components should identify the domain corresponding to the content path while linking the pages from different sites — ResourceResolver.map(…))

We should use the etc mapping to enable the forward resolving(resolve the incoming URL to content path) and reverse mapping (map the content path to the domain)

As a first step create an environment specific mapping folder (sling:Folder)— /etc/map.dev.publish, the etc mapping configurations won’t honor the run mode but it is possible to enable the environment specific configuration by enabling different folders e.g map.dev.publish, map.uat.publish, map.stage.publish and map.prod.publish and configure the folder to the run mode specific JCR Resolver configuration( “Apache Sling Resource Resolver Factory”).

Create a folder http or https(sling:Folder) under map.dev.publish based on the protocol used to communicate to publisher, use https even the SSL is terminated at load balancer level — the mapping details can be stored to code repository for better management.

Enable the below Sling Mappings under /etc/map.dev.publish /http(s) based on the protocol used— this will enable the forward mapping(resolve) — map the incoming URL to the content path(forward mapping is optional as the dispatcher is already sending the complete content path to publisher) and reverse mapping (map)— map the content path to shortened DNS URL.



This post first appeared on Albin's, please read the originial post: here

Share the post

Configure Sling Mapping for Resource Resolution in Adobe Experience Manager — Deep Dive

×

Subscribe to Albin's

Get updates delivered right to your inbox!

Thank you for your subscription

×