Aem 6.5 - Customized ModelExporter | Community
Skip to main content
robertol6836527
Level 4
March 22, 2024
Solved

Aem 6.5 - Customized ModelExporter

  • March 22, 2024
  • 2 replies
  • 730 views

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.
Best answer by DPrakashRaj

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
March 23, 2024

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/

pulkitvashisth
Community Advisor
Community Advisor
March 23, 2024

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.