Expand my Community achievements bar.

SOLVED

DAM image URL Mapping with resource resolver mapping (etc/map)

Avatar

Level 2

Can we do resource resolver mapping for DAM URLs like for content path we can?

Lets say we have a DAM URL like (/content/dam/test/en_us/footer.png), in publisher we can refer that image like http://localhost:4503/content/dam/test/en_us/footer.png

and we have dispatcher configured for the above publisher , where Images are getting cached.

But when we go to the site via dispatcher Eg. apache server , we get the image URLS like a relative URL like /content/dam/test/en_us/footer.png.

Can we do some resolver mapping , so that request coming with /content/dam/test -> http://test.example.com/content/dam/test.

1 Accepted Solution

Avatar

Correct answer by
Level 10
10 Replies

Avatar

Level 10

If you have used the relative path, then it should append the domain. it depends on how you are getting the path of the image.

Avatar

Level 2

I have tried this, but still no expected result .

 

Attaching etc/map

[img]Capture.PNG[/img]

Avatar

Employee Advisor

Did you create a custom request rewriter as mentioned in the article  ? 

Avatar

Level 2

Custom request writer i did not try, but i tried with the etc/map configuration.

other content URls are mapped to respective path, 

    Eg. /content/test/en_us -> http://test.example.com/content/test/en_us

         /content/test1/en_us -> http://test.example.com/content/test1/en_us

but /content/dam -> http://test.example.com/content/dam is not happening.

Is there any other configuration needs to be set from system/console/bundles?

Avatar

Employee Advisor

The default request rewriter in CQ does not rewrite URLs if they do not have HTML extensions. And therefore the DAM urls are not rewritten. You will have to implement a custom request rewriter to achieve rewriting of DAM urls. The same is mentioned in the article I had shared earlier. You can refer to the example code for the rewriter here - http://dev.cqblueprints.com/nexus/content/repositories/releases/com/cqblueprints/cqblueprints-all-re...

Avatar

Level 2

Thanks for the help, custom CQ request writer solves the issue.smiley

Avatar

Level 2

If i Want to create a custom request writer service like blue prints project, need small help.

I have created one java class like attached, i have used this in my existing bundle.

Service being registered , but its not rewriting the URLs,

Is there anything i am missing for this?

Avatar

Correct answer by
Level 10