How to add a selector to a json servlet?
Hi guys,
I'm working in AEM 6.3 and writing a servlet that will be producing json data. I'm using the following annotation based configuration:
@Slf4j
@Component(
immediate = true,
service = Servlet.class,
property = {
"sling.servlet.methods=get",
"sling.servlet.resourceTypes=resourceName",
"sling.servlet.selectors=js",
"sling.servlet.extensions=json"
},
configurationPid = "com.package.ServletName"
)
I have a resource of sling:resourceType at /content/path/jcr:content and when I place a GET request to http://localhost:4502/content/path/jcr:content.js.json, I expect to see the results of my servlet, but I see this:
Invalid recursion selector value 'js'
Cannot serve request to /content/path/jcr:content.js.json on this server
If I change my servlet to hardcode the path using sling.servlet.paths, it works, but I don't want to hardcode the path.
Any help would be appreciated.I would also appreciate any general explanations as to how AEM prioritizes matching on path, resourceType, selector, and extension when choosing which servlet to delegate to.
Thanks much!!!