Leiste mit Community-Erfolgen erweitern.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

Diese Konversation wurde aufgrund von Inaktivität geschlossen. Bitte erstellen Sie einen neuen Post.

GELÖST

Header/Footer from external service

Avatar

Level 1

Hi Everyone - I have a requirement to consume header/footer hosted on our react application. React team has built an endpoint for both header and footer which when called return complete html ( including js and css references). I was planning to build a simple header and footer component and through SlingModel call these two endpoints and include api response. These components will then be included in experience fragments and will be part of editable templates. 

My concern/question is will there be call to SlingModel ( which in turn will make an http call to react api's) for every page built using editable template? If yes, how can i limit backend API calls to just one time and then use the response for all the pages?

 

Thanks in advance.

 

~Pragya

1 Akzeptierte Lösung

Avatar

Korrekte Antwort von
Community Advisor

Hi @praja1987,

Please check this Sling Model Caching, it may helps you to avoid multiple invocation.

https://sling.apache.org/documentation/bundles/models.html#caching

You only have to specify cache=true in the Model-annotation.

@Model(adaptable = SlingHttpServletRequest.class, cache = true)
public class ModelClass {
   ...
}  

Regards,

Santosh 


Santosh Sai

AEM BlogsLinkedIn


Lösung in ursprünglichem Beitrag anzeigen

1 Antwort

Avatar

Korrekte Antwort von
Community Advisor

Hi @praja1987,

Please check this Sling Model Caching, it may helps you to avoid multiple invocation.

https://sling.apache.org/documentation/bundles/models.html#caching

You only have to specify cache=true in the Model-annotation.

@Model(adaptable = SlingHttpServletRequest.class, cache = true)
public class ModelClass {
   ...
}  

Regards,

Santosh 


Santosh Sai

AEM BlogsLinkedIn