Konrad Windszus wrote
> 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 “/".
> 

We wanted to make using such servlets easy. In general the developer of
the servlet does not know the configuration of the resource resolver and
using absolute paths would make him require to know this. Of course, if
the developer doesn't know or picks a wrong path, this can be changed
through configuration - which is not really nice.
Being able to simply specify that this servlet has the highest priority
(or any other through the index) decouples these things and avoids
reconfiguration.

Maybe you can explain what problem you're trying to solve?

Carsten
-- 
Carsten Ziegeler
Adobe Research Switzerland
[email protected]

Reply via email to