Level 1
Level 2
Melden Sie sich an, um alle Badges zu sehen
Hi All,
I need to create a custom Servlet code where we need to iterate over the children and grandchildren of components on a certain page to create the output json of those components. We could do it using infinity.json OOTB , but we dont want to use the same as those are not recommended to be used in production . also we dont need to output all the components as json , we need to output as per the resource type.
Does anyone has any pointer or reference code to achieve the same.
Thanks
Gelöst! Gehe zu Lösung.
Zugriffe
Antworten
Likes gesamt
Hi,
you can check code here
Zugriffe
Antworten
Likes gesamt
Hi @tnik,
I think you do not need servlet to achieve your goal. Use Sling Model Exporters feature instead.
Please explore official Adobe documentation to get full set of information in terms of Sling Model Exporter concept and implementation guides:
Zugriffe
Antworten
Likes gesamt
Hi Lukasz-m ,
The issue is if we add sling model exporter to the components , we need to invoke them on 1 to 1 basis as per the component path , if we hit the Page path , it does not return the json for the components. We have already tried that
Thanks
Zugriffe
Antworten
Likes gesamt
hi As mention by @lukasz-m , model.json must do a job.
but if you think you need a custom solution, I created something similar for PoC, you can test try that out
https://aemlab.blogspot.com/2019/07/get-json-response-of-aem-page.html
Zugriffe
Antworten
Likes gesamt
@arunpatidar model.json is not returning the json for custom component on hitting the page directly , if we give the component path then it returns the expected json.
Also regarding the POC you did , does it exports all the custom properties of all the components on the page?
Thanks
Zugriffe
Antworten
Likes gesamt
I want to loop the nodes as per resource types , but each component has different structure so how did you manage the component nodes to fetch properties from each one of them
Thanks
Zugriffe
Antworten
Likes gesamt
Hi,
you can check code here
Zugriffe
Antworten
Likes gesamt
Zugriffe
Antworten
Likes gesamt
Thanks @arunpatidar , this what we were looking for , i assume the solution is compatible with AEMaaCS
Zugriffe
Antworten
Likes gesamt
Zugriffe
Likes
Antworten
Zugriffe
Likes
Antworten
Zugriffe
Likes
Antworten
Zugriffe
Likes
Antworten