That is a very interesting option. I hadn't realized how useful the Post servlet was.
When I want to aggregate the data back together again, I can obviously write a JSP page to do it, but is there a mechanism already in place? For example if I post the JSON fragment I gave earlier, I would quite like to get the same fragment back at the root address. Thanks again On Sun, Jul 10, 2011 at 1:24 PM, sam lee <[email protected]> wrote: > How about: > > /projects/sling > /projects/sling/jcr:content > /projects/sling/jcr:content/mailingLists > /projects/sling/jcr:content/mailingList/users > /projects/sling/jcr:content/mailingList/devs > > /projects/couchdb > ... > > Then, each project will have json like: > > GET /projects/sling.tidy.-1.json > { > "jcr:primaryType": "nt:unstructured", > "jcr:content": { > "jcr:primaryType": "nt:unstructured", > "jcr:title": "Sling", > "jcr:description": "is a web framework that uses a Java Content > Repository", > "mailingLists": { > "users": { > "jcr:primaryType": "nt:unstructured", > "subscribe": "[email protected]" > }, > "devs": { > "jcr:primaryType": "nt:unstructured", > "subscribe": "[email protected]" > } > } > } > } > > > > And, you can POST the json to create content, too: > http://sling.apache.org/site/manipulating-content-the-slingpostservlet-servletspost.html#ManipulatingContent-TheSlingPostServlet%2528servlets.post%2529-ImportingContentStructures > > > Usually, JSON objects are Nodes. JSON arrays are attributes of a Node. > > > On Sun, Jul 10, 2011 at 4:24 AM, Phil Rice <[email protected] >> wrote: > >> First of all thanks very much for the earlier help on getting going. I >> now have a Sling up and running and am happily posting and getting >> data from it. >> >> At the moment the data that I post is in the form of attribute values >> pairs (as though I had posted from a form in html), and I would like >> to increase the complexity of the data. >> >> Naively its easy: I can put a JSON or XML blob as the value of one of >> the attribute pairs, and as long as I am careful with escaping, I will >> get the same data back. However I am not sure that I am using Sling / >> Jackrabbit to its best advantage, and wondered what the rest of you >> do. >> >> An example set of data that I might want to put in: >> >> {"Name":"Sling", >> "comment":"is a web framework that uses a Java Content Repository, >> such as Apache Jackrabbit, to store and manage content", >> "mailingLists":["Sling Users List >> ",{"subscribe":"[email protected]"}, >> >> {"unsubscribe":"[email protected]"}, >> >> {"archive":"http:\/\/mail-archives.apache.org\/mod_mbox\/sling-users\/"}, >> "Sling Developers List >> ",{"subscribe":"[email protected]"}, >> >> {"subscribe":"[email protected]"}, >> >> {"archive":"http:\/\/mail-archives.apache.org >> \/mod_mbox\/sling-dev\/"}],"website":"sling.apache.org\/", >> "releases":["6","5","4"]} >> >> As you can see mostly its attribute value pairs, so I could code each >> attribute/value pair as a post parameter. Of course this is recursive >> data structure, so one of the values (for example mailingLists) then >> has a coded values. I can obviously make the mailingLists its own >> node... >> >> In my previous life I have played quite a bit with Ontologies, and in >> a sense this is similar problem to deciding whether something is a >> class or an instance. What I mean by this is "should my values be >> coded as attribute/value pairs in a node, or as nodes in their own >> right". I am sure there is a "standard" answer to this, and I wonder >> if the rest of you have settled on a standard answer. >> >> At the moment I have no feeling for the "cost" of a node. Its >> obviously possible to store a lot of data in a node, or to split the >> data up across nodes. I'd appreciate anyone else's thoughts on the >> trade-offs involved >> >
