Hi Team,
How it be possible to run sling model with custom selector without appending jcr:content in the url ?
similar issue : https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/register-sling-model-expor...
http://localhost:4502/content/tmt/en/test-pages/_jcr_content.nt.content.tidy.json
Thanks
Views
Replies
Total Likes
Hi,
I assume you are talking about the Sling model exporter, if so, yes, you can actually configure the extension and selector(s)
@Model(adaptables = Resource.class, resourceType="/apps/myApps/components/myComponent", defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
@Exporter(name = "jackson", selector="mySelector", extensions = "myextension", options = { @ExporterOption(name = "SerializationFeature.WRITE_DATES_AS_TIMESTAMPS", value = "true") })
Here you can find a detailed article explaining how to use the Sling Model Exporter using custom selectors http://sgaem.blogspot.com/2017/06/sling-model-exporter-in-aem-63.html
If, on the other hand, you are trying to access something like this: http://localhost:4502/content/tmt/en/test-pages/_jcr_content.nt.content.tidy.json without "jcr:content" in the path, you could set up a redirect. However, the full path is most likely correct because it clearly indicates the source of the "json" data.
Hope this helps.
Thank you!
Similar approach I have followed but <resoucePath>.model.json works why not <resourcePath>.custom.test.json works.
Do you know why I need to write the redirect?
I assume it's ootb behavior that handles model.json resolution for pages in that manner so we can avoid appending jcr content . One option I can think of is writing a sling filter to forward the request to /jcr:content.custom.json when selector is custom and incoming path is indeed a cqpage. But again the question is where is it that you want this custom selector? If it's spa use local Dev model client to append the path instead of implementing a backend solution. Hope this info helps.
@Sumit30908642ioye Do you find the suggestions from users useful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Hello
To run a Sling Model with a custom selector without appending "jcr:content" to the URL https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/register-sling-model-expor...Salesforce Marketing Cloud Course in AEM, follow these steps:
This allows you to access the desired content without "jcr:content" in the URL.
Thank you.
Views
Likes
Replies