Fantastic! After 5 hours of scratching my head writting esp scripts and trying to get a sling:resourceType onto a folder... all I had to do was put the number 2 in between my folder name and the .json. I knew there must be a simpler way than what I was doing!
I will read through the specs again and again until I have it all indexed into my brain and will also start experimenting with NodeIterator you suggested. A big thanks! kbar Ian Boston wrote: > > Probably the best thing to do, if you cant find the answer in > documentation is to subscribe to [email protected] and ask the > question there. > > But here are some quick pointers: > > There are several answers to your question. > > 1. query the REST URL for the purpose from a client (e AJAX) > > eg if your folder is a /testfolder then GET http://host/testfolder.2.json > will list the contents and properties of all child nodes. The 2 > says go down 2 levels. > > > 2. Sling is based on resources, requests are bound to resources so > that a request.getResource() will give you a Resource. *If* the > Resource happens to be a JCR Node then the resource can be adapted to > a node with Node myNode = resource.adaptTo(Node.class); From there on > you can use the javax.jcr.* API (JSR-170, JSR-283) to get information > about the nodes. I would recommend you skim read at first the JSR-170 > spec and possibly the JSR-283 spec to understand about how javax.jcr.* > works. > > 3. In ESP and the other scripting languages there is a variable > already there "currentNode" that is the current node the script is > bound to. > > > currentNode.getNodes() will give you a NodeIterator to all child nodes > of a parent node > > HTH > Ian > > > On 27 Sep 2009, at 08:17, kbar wrote: > >> >> I am new to the world of Java based web development. I am finding >> myself >> constantly hitting road blocks while trying to learn Jackrabbit and >> Sling >> because the documentation assumes that you already know alot of >> previous >> things. So I was wondering if someone could give me a good learning >> path >> that I could follow to get myself up to speed. >> >> As an example all I am currently trying to do is just list the >> contents of a >> folder using Sling and I am unable to figure out how to do it. I am >> messing >> with Jackrabbit, Sling, esp, groovy, servlets and all sorts of >> technology >> and am just digging myself a bigger hole with more technology flying >> at me. >> I have been crawling the sling and jackrabbit sites but can't find >> anything >> for a newbie like myself. >> >> Can someone recommend a list of things to learn and in what order. >> Also >> perhaps any good books from amazon or websites that I could look at? >> >> Cheers, >> kbar >> -- >> View this message in context: >> http://www.nabble.com/Jackrabbit%2C-Sling%2C-JCR%2C-Servlets-learning-path-tp25631394p25631394.html >> Sent from the Jackrabbit - Users mailing list archive at Nabble.com. >> > > > -- View this message in context: http://www.nabble.com/Jackrabbit%2C-Sling%2C-JCR%2C-Servlets-learning-path-tp25631394p25631728.html Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
