Skip to main content
robertol6836527
Level 4
Mar 22, 2024 7:29 PM UTC
Solved

Aem 6.5 - Customized ModelExporter

HI,

 

in Adobe Aem 6.5 cloud version I would like to create a customized ModelExporter to export some page contents to json.

 

I would like my ModelExporter to respond to the following url: http://localhost:4502/content/my-page.my-seolector.my-extension where my-seolector sees to be different from "model" and my-extension different from "json ".

 

I tried to make a mapping of the following type but it doesn't work:

 

@Model(adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL, resourceType = "xxx/components/structure/page")
@3484101(name = "jackson", selector = "my-seolector", extensions = "my-extension", options = { @ExporterOption(name = "SerializationFeature.WRAP_ROOT_VALUE", value = "true")})

 

Could you tell me how to do it?

 

Thank you

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
DPrakashRaj
DPrakashRajAccepted solution
Community Advisor
Mar 23, 2024 2:54 AM UTC

It seems you need to configure custom mime type in Apache Sling MIME Type Service as explained on

https://taradevko.com/aem/sling-model-exporter-now-really-custom/

2 replies

DPrakashRaj
Community Advisor
DPrakashRajCommunity AdvisorAccepted solution
Community Advisor
Mar 23, 2024 2:54 AM UTC

It seems you need to configure custom mime type in Apache Sling MIME Type Service as explained on

https://taradevko.com/aem/sling-model-exporter-now-really-custom/

Translate
pulkitvashisth
Community Advisor
Community Advisor
Mar 23, 2024 5:30 AM UTC

Hi @robertol6836527 
You sling model exporter declaration is fine, can you post what exact error are you getting.
Also can you try with url http://localhost:4502/content/my-page/jcr:content.my-seolector.my-extension as the resource type for page is actually at the page content node.
So maybe sling model exporter is not getting triggered.
If none of this works , check in error logs if anything is breaking or any exception is there when you are hitting the sling model exporter url.

Translate