Hi,
I'm trying to use sling exporter framework (Adobe Experience Manager Help | Developing Sling Model Exporters in AEM , Apache Sling :: Sling Models to export sling model data. This is for Content As A Service.
My requirement is that, in CaaS REST api url, I should be able to pass query parameter so that we can return/export data accordingly based on the parameter value.
For that i added custom sling selector option in Sling Model exporter to expose JSON accordingly.
Here is a snapshot of the class. If you look at it, i'm setting the "selector" attribute with "mobile"
The url i'm hitting:
http://localhost:6502/content/wcms/api/v1/as/devicedata.mobile.json
This give me error "
It seems that the request is getting resolved by DefaultGetServlet instead of the dynamically generated Sling Models Exporter Servlets.
I can see the exporter servlets class here :http://localhost:6502/system/console/status-slingmodels
Any guidance is greatly appreciated.
Thanks
Ved
Solved! Go to Solution.
Views
Replies
Total Likes
So this combination is working.
Url:
http://localhost:6502/content/wcms/api/v1/as/devicedata/jcr:content.mobile.json
Dependency:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${fasterxml.jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${fasterxml.jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${fasterxml.jackson.version}</version>
</dependency>
<fasterxml.jackson.version>2.5.2</fasterxml.jackson.version>
Views
Replies
Total Likes
Hi,
Try below if helps:
@Model(adaptables = Resource.class, resourceType="/apps/myApps/components/myComponent", defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
@Exporter(name = "jackson", selector="mobile", extensions = "json", options = { @ExporterOption(name = "SerializationFeature.WRITE_DATES_AS_TIMESTAMPS", value = "true") })
Please check AEM Developer Learning : Sling Model Exporter in AEM 6.3 for more info
Views
Replies
Total Likes
Hi Arun,
I already tried that. No success. I get the same error.
Cannot serve request to /content/wcms/api/v1/as/devicedata.mobile.json in org.apache.sling.servlets.get.DefaultGetServlet
Not sure if i need to install any feature pack. I have these installed.
Service Pack 2 | AEM-6.3.2.0-6.3.2.zip |
Cumulative Fix Pack 2 | aem-6.3.2-cfp-2.0.zip |
Updated FP for content service on SP2 | cq-6.3.0-featurepack-24425-1.0.2.zip |
WCM Core Component 2.0.8 | core.wcm.components.all-2.0.8.zip |
WCM Core component extension 1.0.4 | core.wcm.components.extension-1.0.4.zip |
Thanks
Ved
Views
Replies
Total Likes
See this Adobe doc for information on this subject - see if this helps...
Adobe Experience Manager Help | Developing Sling Model Exporters in AEM
Views
Replies
Total Likes
Hi,
I tried in AEM 6.3 works for me.
Except below dependancy, I didn't do anything.
I am accessing resource like http://localhost:4502/content/AEM63App/language-masters/en/jcr:content/mainContent/hero_banner.mobil...
where hero_banner is my component node which I specified at in model annotation resourceType="/apps/myApps/components/myComponent
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.models.jacksonexporter</artifactId>
<version>1.0.0</version>
</dependency>
Views
Replies
Total Likes
So this combination is working.
Url:
http://localhost:6502/content/wcms/api/v1/as/devicedata/jcr:content.mobile.json
Dependency:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${fasterxml.jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${fasterxml.jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${fasterxml.jackson.version}</version>
</dependency>
<fasterxml.jackson.version>2.5.2</fasterxml.jackson.version>
Views
Replies
Total Likes
Views
Likes
Replies