Understand Sling Model Exporter | AEM Community Discussion

Avatar

Avatar

kautuk_sahni

Community Manager

Total Posts

5.6K

Likes

1.0K

Correct Reply

1.1K

Avatar

kautuk_sahni

Community Manager

Total Posts

5.6K

Likes

1.0K

Correct Reply

1.1K
kautuk_sahni
Community Manager

25-08-2020

BlogImage.jpg

Understand Sling Model Exporter by Adobe Docs

Abstract

Apache Sling Models 1.3.0 introduces Sling Model Exporter, an elegant way to export or serialize Sling Model objects into custom abstractions. This article juxtaposes the traditional use-case of using Sling Models to populate HTL scripts, with leveraging the Sling Model Exporter framework to serialize a Sling Model into JSON.

Traditional Sling Model HTTP Request flow
The traditional use-case for Sling Models is to provide a business abstraction for a resource or request, which provides HTL scripts (or, previously JSPs) an interface for accessing business functions.
Common patterns are developing Sling Models that represent AEM Components or Pages, and using the Sling Model objects to feed the HTL scripts with data, with an end result of HTML that's displayed in the browser.

Sling Model Exporter HTTP Request flow
Apache Sling Model Exporter comes with a Sling provided Jackson Exporter that automatically serializes an "ordinary" Sling Model object into JSON. The Jackson Exporter, while quite configurable, at its core inspects the Sling Model object, and generates JSON using any "getter" methods as JSON keys, and the getter return values as the JSON values.

Read Full Blog

Understand Sling Model Exporter

Q&A

Please use this thread to ask the related questions.

AEM AEMIBlogSeeding Experience Manager