Would it probably make sense to also consider the resource resolver search path
in the method Resource.isResourceType(String type)
(https://github.com/apache/sling/blob/4df9ab2d6592422889c71fa13afd453a10a5a626/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java#L194)
in case a relative type is given?
Very often the "sling:resourceType" is set as relative resource type, to make
it possible to overlay some Sling scripts from /libs at /apps. But resources
pointing to the same absolute resource type (below /libs or /apps) should
behave more or less the same.
Unfortunately although from a rendering perspective it is the same if you give
in your request resource the relative path or the absolute path, it does make a
difference if there is some code involved checking for the required resource
type with Resource.isResourceType(String).
Right now the property is just compared with equals to the current resource's
resourceType. That means that for resourceA with resourceType =
"sling/some/type", resourceA.isResourceType("/libs/sling/some/type") would
return false.
On the other hand if resourceA has resourceType = "/libs/sling/some/type",
resourceA.isResourceType("sling/some/type") would return false as well.
I think at least the latter case should return true, which means that
isResourceType should consider all resource resolver search paths if a relative
resource type is given and should compare with any of the possible absolute
resource path. If one of those matches, it should return false.
Since as a developer you can very often not control whether the resource type
is given in an absolute or relative fashion in the request's resource you often
have to check for all possible resource types. From the tediou
WDYT?
Does that sound reasonable to you?
Thanks in advance for your input.
Konrad