Expand my Community achievements bar.

SOLVED

Rewrite rendered page URL in component model

Avatar

Level 8

Hi

I need to rewrite the rendered page URL in AEM 6.5.11 in a java component model depending on certain conditions. What method do I use for rewriting the url? 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

By default AEM rewrites (that means the conversion from a repository path to the path part of a URL) all URLs when they are rendered as part of a HTML response. In this case you don't need to do anything.

 

There might be cases, where you want to convert a repository path to an URL path within JSON output. Use [1] to rewrite the path.

 

[1] https://sling.apache.org/apidocs/sling11/org/apache/sling/api/resource/ResourceResolver.html#map-jav...

View solution in original post

1 Reply

Avatar

Correct answer by
Employee Advisor

By default AEM rewrites (that means the conversion from a repository path to the path part of a URL) all URLs when they are rendered as part of a HTML response. In this case you don't need to do anything.

 

There might be cases, where you want to convert a repository path to an URL path within JSON output. Use [1] to rewrite the path.

 

[1] https://sling.apache.org/apidocs/sling11/org/apache/sling/api/resource/ResourceResolver.html#map-jav...