Hi,
With https://issues.apache.org/jira/browse/SLING-910 a service property for 
servlets was invented called “sling.servlet.prefix” (ok, that was quite some 
time ago, I admit)
The default for it is "/apps”. It is used as prefix which is concatenated with 
the value of “sling.servlet.resourceTypes” in case the latter does not start 
with a “/“.

In my case the default for the Sling Servlet Resolver was overwritten to be 
“-1” meaning the last entry from the resource resolver search paths.
I don’t get any good use case where the service property “sling.servlet.prefix” 
could be useful for?

I would rather say you should always use an absolute path for 
“sling.servlet.resourceTypes”.
Relying on the default (-1 in my case) would lead to servlets being registered 
in “/libs/foundation/components/primary/“ (in the case of AEM) which is not the 
right place for custom servlets IMHO.

Can you give me some insights on why this has been invented initially and what 
speaks against the rule “Always give the resource type as absolute path in the 
servlet registration”? After all, this is what you also do with all the 
scripts. I would even recommend to utter a warning in the Sling annotation 
processor whenever a resourceType attribute is used there which does not start 
with a “/".

Thanks,
Konrad

Reply via email to