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

Avatar

Avatar

ManojSj

Avatar

ManojSj

ManojSj

06-11-2020

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.

AEM 6.4.7 CAAS JSON Sling Model

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

sureshd71454102

Avatar

sureshd71454102

sureshd71454102

06-11-2020

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

 

@ValueMapValue
@Optional
private String fullurl;

 

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

Answers (0)