[ https://issues.apache.org/jira/browse/SLING-2467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13271818#comment-13271818 ]
Felix Meschberger commented on SLING-2467: ------------------------------------------ The idea of the explicit resource type allows for better inheritance. For example a sling:OrderedDocument extending sling:Document will have a resource type of sling:OrderedDocument which will be the sling/OrderedDocument path and will not be handled by sling:Document which is sling/Document and from the perspective of Sling sling/Document is not a resource super type to sling/OrderedDocument. Having a default resource type assigned would make it easier to use sling:Document or sling:OrderedDocument or even some extended node type. I'm ok with allowing empty documents and jcr:content not being mandatory. In this case the default document GET servlet would probably be an OptingServlet which does not handle the request for an empty request thus allowing the default GET servlet to kick in. > Define Document-like node type with jcr:content child and default handling > servlet > ---------------------------------------------------------------------------------- > > Key: SLING-2467 > URL: https://issues.apache.org/jira/browse/SLING-2467 > Project: Sling > Issue Type: New Feature > Components: JCR > Reporter: Felix Meschberger > > The JCR specification allows for nodes to have a dual nature: As part of a > hierarchy containing documents (as a folder in a filesystem) and as a > container for actual data (as a file in a filesystem). There are also two > node types defined to reflect the filesystem notions: nt:folder for folders > and nt:file for Files. > The nt:file nodetype requries a child node "jcr:content" to provide the > actual contents of the file. This child node defaults to be of type > nt:resource but can actually be anything and as such provide structured data > in addition to just plain binary data (in the jcr:data property). > Yet, nt:file and nt:folder are just that: nt:file for file data not > containing children and nt:file for folders but to not contain structured > data. > We should define a node type which can be used to really convey this dual > nature as a data container (file) and document container (folder) at the same > time. > So I propose the following node types: > [sling:Document] > nt:hierarchyNode, sling:Resource > - sling:resourcetype (String) = "sling/document" auto mandatory > - * (undefined) > - * (undefined) multiple > + jcr:content (nt:base) = nt:unstructured mandatory > + * (nt:base) = granite:Document version > [sling:OrderedDocument] > sling:Document > orderable > + * (nt:base) = sling:OrderedDocument version > In addition we create default GET servlet for handling the sling/document > resource type: > if the resource has a jcr:content child > then include jcr:content > else sendError 404 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira