Absolute URL for assets and links localized to AEM in content fragments | Community
Skip to main content
Level 2
November 6, 2020
Solved

Absolute URL for assets and links localized to AEM in content fragments

  • November 6, 2020
  • 1 reply
  • 3825 views

Hi Experts,

 

We have a use case to send the absolute or full URL's for localized assets/links configured from AEM in fragments. This is being consumed by another non aem application by making model json API call. The content fragments authored with links have relative URL's in JSON. Is there a way to achieve this without code changes at present in AEM 6.4.x version? If not, could you please let us know how we can achieve or go about this request?

 

Edit: This query is not related to custom components created using sling models or at component level. It's Absolute url for all assets and content links to be available for all content fragments created using a content model. 

 

Thanks.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SureshDhulipudi

If you are using Sling Model to send the URL to JSON, you can construct the Url explicitly in the URL variable

 

@ValueMapValue
@7392697
private String fullurl;

 

@PostConstruct
private void activate(){
// build the Full URL with absolute path
fullurl = <<<construct -- path>>> ;
}

1 reply

SureshDhulipudi
Community Advisor
SureshDhulipudiCommunity AdvisorAccepted solution
Community Advisor
November 6, 2020

If you are using Sling Model to send the URL to JSON, you can construct the Url explicitly in the URL variable

 

@ValueMapValue
@7392697
private String fullurl;

 

@PostConstruct
private void activate(){
// build the Full URL with absolute path
fullurl = <<<construct -- path>>> ;
}

ManojSjAuthor
Level 2
November 6, 2020

Hi @sureshdhulipudi,

This is applicable for individual or custom component implemented using sling models, which is not relevant for our case. Our use case is to have absolute url for all assets and content links to be available for all the content fragments created using content model whenever a JSON GET call is made to it.

Thanks