Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Configure Sling Mapping for Resource Resolution

Avatar

Level 4

Hi,

I am referring to this article http://dev.day.com/docs/en/cq/current/deploying/resource_mapping.html to configure resource mapping.  I am using my publish instance with Geometrixx sites.

I created the mapping that prefixes any request to http://myserver:4503/ with /content:  This works somewhat correctly.  With the mapping, when I browse to http://myserver:4503, I get rerouted to http://myserver:4503/geometrixx/en/toolbar/account/login.html?resource=%2Fgeohome&$$login$$=%24%24lo...  

The page has missing images and styles.  The section "Configure Sling Mapping for Resource Resolution" in the article https://dev.day.com/docs/en/cq/current/deploying/dispatcher/disp_domains.html suggests that I look into the error.log for my publish instance to find out what other mappings I need to make.  In the error.log file, I see 

01.01.2014 10:55:15.516 *INFO* [137.57.102.28 [1388602515514] GET /etc/designs/default/0.gif HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource /content/etc/designs/default/0.gif not found

 

01.01.2014 10:55:15.516 *INFO* [137.57.102.28 [1388602515514] GET /etc/designs/default/0.gif HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource /content/etc/designs/default/0.gif not found

 

I proceeded to add the following mappings and refreshed the page.

                
/etc/map/http/branda.com/etcsling:Mapping 
/etc/map/http/myserver_any/etc/designssling:MappingName: sling:internalRedirect
Type: String
Value: /etc/designs
/etc/map/http/myserver_any/etc/clientlibssling:MappingName: sling:internalRedirect
Type: String
Value: /etc/clientlibs

The log still says 

01.01.2014 10:59:05.297 *INFO* [137.57.102.28 [1388602745295] GET /etc/designs/default/0.gif HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource /content/etc/designs/default/0.gif not found

I checked the system/console/jcrresolver and found the following mapping map entries

                                
Mapping Map Entries
Lists the entries used by the ResourceResolver.map methods to map Resource Paths to URLs
PatternReplacementRedirect
^/etc/clientlibs/http://myserver:4503//etc/clientlibs/external: 302
^/etc/designs/http://myserver:4503//etc/designs/external: 302
^/content/http://myserver:4503/external: 302
^/libs/http://myserver:4503//libs/external: 302

If I edit my etc/map/http/myserver_any sling:mapping, and remove the property sling:internalRedirect to /content/, I see the site loading correctly with images and styles, but the URL now shows http://myserver:4503/content/geometrixx-outdoors/en.html.  I had wanted it to only show http://myserver:4503/geometrixx-outdoors/en.html.

What am I doing wrong?  Please advise.

Thank You.

1 Accepted Solution

Avatar

Correct answer by
Level 5

Hello,

Reason why it is going to that link because you are trying to redirect myserver.4503/ to /content/ and any thing without extension or "/" goes through login selector and hence you see default login page for CUG enabled resources.

Now there is two thing,

1) You want to redirect your root to some page, For that please see http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

you have to do something like,

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"

    jcr:primaryType="sling:Mapping"

    sling:internalRedirect="/geometrixx-outdoors/en.html"

    sling:match=".*host.(4503|80)+/$"/>

 

2) you want to remove /content/ from url, For that configure resource resolver setting "Apache Sling Resource Resolver Factory" in host:port/system/console/configMgr and add URL mapping /:/ and /content/:/

 

Let me know if everything works after that.

 

Yogesh

View solution in original post

3 Replies

Avatar

Level 10

Hi Voon Siong,

Remove your current configuration and then At [1] for url mapping add /content/:/ . Verify & let us know how it goes.

For Image for form rewrite please use transformer http://helpx.adobe.com/experience-manager/kb/HowToImplementACustomRewriterTransformerFactory.html

[1]   http://host:port/system/console/configMgr/org.apache.sling.jcr.resource.internal.JcrResourceResolver...

Thanks,
Sham

Avatar

Level 4

Sham HC wrote...

Hi Voon Siong,

Remove your current configuration and then At [1] for url mapping add /content/:/ . Verify & let us know how it goes.

For Image for form rewrite please use transformer http://helpx.adobe.com/experience-manager/kb/HowToImplementACustomRewriterTransformerFactory.html

[1]   http://host:port/system/console/configMgr/org.apache.sling.jcr.resource.internal.JcrResourceResolver...

Thanks,
Sham

 


Hi Sham,

Thank You for your reply.  I removed all the configured entries and did the following

  1. Using CRXDE navigate to /etc/map/http.
  2. Create a new node:
    • Type sling:Mapping
      This node type is intended for such mappings, though its use is not mandatory.
    • Name myserver_any
  3. Click Save All.
  4. Add the following properties to this node:
    • Name sling:match
      • Type String 
      • Value myserver.4503/
    • Name sling:internalRedirect
      • Type String
      • Value /content/
  5. Click Save All.

Now, when I type in http://myserver:4503, I get to http://myserver:4503/geometrixx/en/toolbar/account/login.html?resource=%2Fgeohome&$$login$$=%24%24lo..., which prompts to login.  I never get the chance to login because after I dismiss the pop up box, the page refreshes.  However, I see that the page is loading correctly with images.  I guess that is an improvement?

Avatar

Correct answer by
Level 5

Hello,

Reason why it is going to that link because you are trying to redirect myserver.4503/ to /content/ and any thing without extension or "/" goes through login selector and hence you see default login page for CUG enabled resources.

Now there is two thing,

1) You want to redirect your root to some page, For that please see http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

you have to do something like,

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"

    jcr:primaryType="sling:Mapping"

    sling:internalRedirect="/geometrixx-outdoors/en.html"

    sling:match=".*host.(4503|80)+/$"/>

 

2) you want to remove /content/ from url, For that configure resource resolver setting "Apache Sling Resource Resolver Factory" in host:port/system/console/configMgr and add URL mapping /:/ and /content/:/

 

Let me know if everything works after that.

 

Yogesh