How to custmize default sling content exporter behaviour in AEM? | Community
Skip to main content
Mario248
Level 7
June 15, 2022
Solved

How to custmize default sling content exporter behaviour in AEM?

  • June 15, 2022
  • 3 replies
  • 1985 views

I want to export the entire page to front end application. The page may contain 1 or 2 text component and image etc. Need to expose all of it is content. for example, http://localhost:4502/editor.html/content/we-retail/language-masters/en/men.model.tidy.json. This will give me the entire page content but along with some misc properties, like lastModifiedDate, allowedComponents, replicatedBy.

 

 

Is there a way to exclude these properties (lastModifiedDate, allowedComponents etc)?

 

 

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 sunil_kumar_

Hi @mario248 ,
Ideally you should not customised existing servlet. If your page structure is fixed or at least you know combinations of components. Then you can easily write a resource type servlet to expose/export required custom content. Add some different selector to differentiate from default servlet.  

3 replies

Pallavi_Shukla_
Community Advisor
Community Advisor
June 15, 2022

hi @mario248 

 

You can implement a custom model and then pick the properties you want to have in the json.

 

Thanks,

Pallavi Shukla

SantoshSai
Community Advisor
Community Advisor
June 15, 2022

Hi @mario248 ,

As per @pallavi_shukla_ suggested yes, you can do it through Sling Model Exporter by annotating @JsonIgnore to the variable which you don't want to expose.

fore more details please have a look at this article: https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/development/develop-sling-model-exporter.html?lang=en

Hope that helps you!

Regards,

Santosh

Santosh Sai
Mario248
Mario248Author
Level 7
June 15, 2022

Yeah I know we can create a model class for a specific component meaning we can create a model class for specific resource type but how do we do it for the entire page? like in my description, I want to export the entire page (/content/we-retail/language-masters/en/men.model.tidy.json) meaning all the component content to be exported. how do we do this at page level ?

 

Also please tell if we can tweak OOTB exporter with exclude properties ?

SantoshSai
Community Advisor
Community Advisor
June 15, 2022

@mario248 honestly, I'm not sure whether we can able to tweak OOTB API. 

However, to answer your first question - please refer this article to customize page properties: https://www.linkedin.com/pulse/how-customize-properties-image-converted-json-aem-65-ragul-r

 

Santosh Sai
sunil_kumar_
sunil_kumar_Accepted solution
Level 5
June 16, 2022

Hi @mario248 ,
Ideally you should not customised existing servlet. If your page structure is fixed or at least you know combinations of components. Then you can easily write a resource type servlet to expose/export required custom content. Add some different selector to differentiate from default servlet.  

Mario248
Mario248Author
Level 7
June 16, 2022

Thank you for your valuable input