Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Sling Reverse Mapping ignoring parameters and special characters like #

Avatar

Avatar
Validate 1
Level 1
nivazdeent97086
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
nivazdeent97086
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
nivazdeent97086
Level 1

13-08-2018

Hi,

I tried using sling reverse mapping to convert my outbound internal URL. URL is getting converted properly but parameters(?#etc) are getting removed.

For Example

+slingMapping

                    +sling:match:localhost.4602/(experience)

                      sling:internalRedirect:/content/we-retail/ca/en/$1

Inbound Request URL :http://localhost:4602/experience/summit-success-in-the-himalayas.html is resolving me successfully to the resource at /content/we-retail/ca/en/experience/summit-success-in-the-himalayas

But the outbound configured Link URL /content/we-retail/ca/en/experience/summit-success-in-the-himalayas.html#abcd is getting converted as http://localhost:4602/experience/summit-success-in-the-himalayas.html by shredding #abcd. Is this the expected behavior. If not how can we resolve this ?

Regards,

Nivazdeen.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

14-08-2018

Hi,

I checked again, For me I am able to convert links into short links using sling mapping but for me It is working as expected in AEM 6.3

Link Created from OOTB Text Component

Screen Shot 2018-08-16 at 12.12.00 AM.png

OUTPUT

Screen Shot 2018-08-16 at 12.14.38 AM.png

Thanks
Arun

Answers (8)

Answers (8)

Avatar

Avatar
Validate 1
Level 2
ajits55484825
Level 2

Likes

0 likes

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 2
ajits55484825
Level 2

Likes

0 likes

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
ajits55484825
Level 2

16-11-2018

HI Nivazdeen,

How did you find out this rewriter service? I am also facing same issue.

Avatar

Avatar
Validate 1
Level 1
nivazdeent97086
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
nivazdeent97086
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
nivazdeent97086
Level 1

17-08-2018

Hi Arun,

I checked in vanilla instance and it is working for me. Later analyzed that there is a Rewriter service(org.apache.sling.rewriter) from master project affecting mine. Apologies for the confusion.

Regards,

Nivazdeen.

Avatar

Avatar
Validate 1
Level 1
nivazdeent97086
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
nivazdeent97086
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
nivazdeent97086
Level 1

13-08-2018

Hi,

The reverse mapping happens automatically following the resolve rules. I have mentioned the configuration which i used in the original question. I am not using sling output rewrite and not manipulating through component code.

Below is the link for the reference

Apache Sling :: Mappings for Resource Resolution

1547810_pastedImage_1.png

Regards,

Nivazdeen.

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

13-08-2018

Hi,

I think the conversion is not automatic. you can access your image using both URLs. I don't understand how on page load /content/abc.html#identifier is converting into http://domain/abc.html

Are you using Sling Output Rewrite or you are manipulating path from components code?

It would be great if you can point us to the docs from where your are referring this?

Thanks

Arun

Avatar

Avatar
Validate 1
Level 1
nivazdeent97086
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
nivazdeent97086
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
nivazdeent97086
Level 1

13-08-2018

Hi Mac,

This use case is my project requirement. We have internal links with #identifier appended at the end. The links are getting converted properly but the #identifier at the end is getting truncated.

For Example. I have a image with URL. The URL is internal path and i configured like /content/abc.html#identifier. Once the page gets loaded the internal URL is getting mapped to http://domain/abc.html truncating the #identifier.

Regards,

Nivazdeen

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

13-08-2018

Can you point to online docs where this is stated as a valid use case please.

Avatar

Avatar
Validate 1
Level 1
nivazdeent97086
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
nivazdeent97086
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
nivazdeent97086
Level 1

13-08-2018

Hi,

The reverse mapping happens automatically because of the configuration applied for sling mapping. No explicit reverse mapping configuration.

Regards,

Nivazdeen

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

13-08-2018

Hi,

How are you converting outbound url /content/we-retail/ca/en/experience/summit-success-in-the-himalayas.html#abcd to inbound(short Url)?