Hi Alex, Alexander Klimetschek schrieb: > Hi all, > > I have a use-case where it would be useful to list the available > resource types from the repository, ie. where a script or servlet is > present to handle it. Since this depends a) on the search path > configured for the resource resolver and b) on the Java servlet > resolution, the proper solution would be included with Sling, probably > in the servlet resolver bundle. > > My use case is to be able to look up available scripts/servlets that > can render a snippet of HTML. These snippets must be put together > before sending the whole block to the client. The mechanism should be > extensible, ie. one should be able to add a new script. For example, > let's assume the base resource type is "myview/snippets" and the > snippets would be put under "(/apps|/libs)/myview/snippets/foobar" and > so on. The list of resource types would give me > myview/snippets/foobar, myview/snippets/something etc. > > An issue is how to separate sub-resource types from selector > sub-folders (does sling still support them?), but this can be solved > by simply returning everything with a folder (and maybe with at least > one "matching" script). > > Oh, and another use-case for that is when you want to handle node > events based on resource types: in the configuration for such a > generic system you want to list the available resource types. > > WDYT?
The problem is that a resource type in Sling is just a string which is used to build a resource path to locate scripts. There is no more semantics contained in resource types. In addition, given a script location of /libs/nt/folder and a search path of [ /apps, /libs ], the resource types /libs/nt/folder and nt:folder and nt/folder resolve to the same location but are three distincts strings. In short, there is no list of resource types and it is not possible to come with a conclusive list of such resource types. Regards Felix
