Expand my Community achievements bar.

How to find OOTB Page Sling model exporter class ?

Avatar

Level 9

I want to override OOTB Page Sling model exporter class. For example - http://localhost:4502/content/we-retail/language-masters/en.model.json this makes a call to OOTB sling model exporter. I want to have similar functionalities with with changes. Is it possible to see source code for this OOTB sling model exporter?

8 Replies

Avatar

Level 9

I am aware about how to create a model exporter class. I am using below code snippet.  I just want to if I can see source code for OOTB page model exporter ( http://localhost:4502/content/we-retail/language-masters/en.model.json ) Is this open source to check ?

 

@Model(adaptables = SlingHttpServletRequest.class, adapters = {Page.class, ContainerExporter.class},

resourceType = "sling/servlet/default", defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)

@exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, selector = "data",

extensions = ExporterConstants.SLING_MODEL_EXTENSION)

Avatar

Level 9

I am trying to understand what OSGI bundle has the OOTB sling model exporter. Do you have any idea ?

Avatar

Community Advisor

Hi @Mario248 ,

 

It is recommended to implement custom model to export the page basing on your resourceType where you can customize extension Exporter framework etc.

for more details kindly refer the article shared by @Saravanan_Dharmaraj as below along with understanding it in depth.

[0]: https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/development/develop-slin...

[1]: https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/development/understand-s...

 

Hope that helps!

Regards,
Santosh

 

Avatar

Level 9

I am aware about how to create a model exporter class. I am using below code snippet.  I just want to if I can see source code for OOTB page model exporter ( http://localhost:4502/content/we-retail/language-masters/en.model.json ) Is this open source to check ?

 

@Model(adaptables = SlingHttpServletRequest.class, adapters = {Page.class, ContainerExporter.class},

resourceType = "sling/servlet/default", defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)

@exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, selector = "data",

extensions = ExporterConstants.SLING_MODEL_EXTENSION)

 

 

 

Avatar

Community Advisor

It will be inside

/libs/cq/page



Arun Patidar

Avatar

Level 9

Thank you @arunpatidar . I looked at /libs/cq/Page but it does not have any logic. proxy.jsp is forwarding or including requests to another resource within the AEM environment. There is no supertype for this as it is a folder. any other location you could think of ?

Avatar

Employee Advisor

The code for the default Jackson Exporter can be found at https://github.com/apache/sling-org-apache-sling-models-jacksonexporter/tree/master/src/main/java/or...

 

Start with the JacksonExporter.java file.