ExamGecko
Question list
Search
Search

Related questions











Question 26 - AD0-E134 discussion

Report
Export

An AEM Developer receives requirements for Sling Models in a human-readable yaml format. A custom application needs to be built. The dependency is as shown:

A.
Answers
A.
B.
Create OSGI models to export as yaml
Answers
B.
Create OSGI models to export as yaml
C.
Configure mime type in Apache Sling MIME Type Service
Answers
C.
Configure mime type in Apache Sling MIME Type Service
D.
Answers
D.
E.
Create OSGI models to export as yaml
Answers
E.
Create OSGI models to export as yaml
F.
Configure mime type in Apache Sling Servlet/Script Resolver and Error Handler
Answers
F.
Configure mime type in Apache Sling Servlet/Script Resolver and Error Handler
G.
Answers
G.
H.
Create Sling models to export as yaml
Answers
H.
Create Sling models to export as yaml
I.
Configure mime type in Apache Sling MIME Type Service
Answers
I.
Configure mime type in Apache Sling MIME Type Service
J.
Answers
J.
K.
Create Sling models to export as yaml
Answers
K.
Create Sling models to export as yaml
L.
Configure mime type in Apache Sling Referrer Filter
Answers
L.
Configure mime type in Apache Sling Referrer Filter
Suggested answer: C

Explanation:

To create Sling Models that can export data in a human-readable yaml format, the following steps are required:

Create Sling models to export as yaml. Sling models are Java classes that can be used to represent resources in AEM. Sling models can use annotations to define how they can be adapted from a resource and how they can export data in different formats. To export data in yaml format, the Sling model class needs to use the @Model annotation with the resourceType parameter set to the resource type of the resource that the model represents. The Sling model class also needs to implement the org.apache.sling.models.annotations.Exporter annotation with the name parameter set to "jackson" and the extensions parameter set to "yaml". The Sling model class also needs to use the @JsonProperty annotation on the fields or methods that need to be exported in yaml format. Configure mime type in Apache Sling MIME Type Service. The Apache Sling MIME Type Service is an OSGi service that maps file extensions to MIME types and vice vers a. To enable the yaml format for Sling models, the MIME Type Service needs to be configured with a new entry for the yaml extension and its corresponding MIME type, which is "application/x-yaml". This can be done by creating an OSGi configuration for the org.apache.sling.commons.mime.internal.MimeTypeServiceImpl service and adding the entry "yaml=application/x-yaml" to the mime.types property. Reference:

https://sling.apache.org/documentation/bundles/models.html

https://sling.apache.org/documentation/bundles/mime-type-support-commons-mime.html

asked 02/10/2024
Prakhar Sengar
33 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first