- resource
- currentNode
- currentPage
currentNode.getPath() is the node that has sling:resourceType
currentPage.getPath() is actual Page (usually, /foo/bar).
so, if you have something like:
<%
iter = queryResult.getNodes(); //returns cq:Page nodes
while (iter.hasNext()) {
sling.include(iter.nextNode().getPath());// resource of the script included will be jcr:content
}
%>For example, SlingScriptHelper
with RequestDispatcherOptions.setForceResourceType() or, <sling:include resourceType="..."/>, the included script (handler)'s resource is NOT jcr:content but the resource itself. (Not /foo/bar/jcr:content, but /foo/bar.. where included resource was /foo/bar).
Okay this is hairy.
Let's work an example.
Client request was:
GET /x/y.html
/x/y's resourceType (handler) is /apps/a/handler.
In /apps/a/handler/handler.jsp, you include /foo/bar (a cq:Page). /foo/bar's resourceType is /apps/b/handler.
You include:
- <sling:include path="/foo/bar.html"/>
- then /apps/b/handler will be used.
- resource is /foo/bar/jcr:content
- currentNode is /foo/bar/jcr:content
- currentPage is /foo/bar
- <sling:include path="/foo/bar" resourceType="c/handler'/>
- /apps/c/handler is used
- resource is /foo/bar
- currentNode is /foo/bar
- currentPage is /x/y