We have requirement where we will have get all the products, accessories, and other information to the products. We are using tags and would like to use queries to get all the info and store in json format to cache in dispatcher.
I can do this in AEM servlet where we can write all the business logic, generate JSON when we request servlet. But calling servlet from sling model is not good idea. could you please advise what are the options we have to generate JSON and cache in dispatcher?
Solved! Go to Solution.
You can generate json and cache at the dispatcher and use front end logic to generate presentation using this json.
@arunpatidar , we are thinking to write business logic in servlet so that we can cache at the servlet json at dispatcher level but the question is how can we refer the sling servlet in Sling Model level to read the json and pass data back to sightly.
Yes, you can directly make a request from front end to servlet without interacting with sling Model.
Small business logic can also be done at front end if needed and the other backend configuration can also be exposed as data-attribute in HTL using sling model