On Mon, Jun 14, 2010 at 19:31, Tony Giaccone <[email protected]> wrote: > > So I think I'm asking too specific a question. > > What I want to do is load up a resource that when viewed through webdav will > be seen as a file with content.
If you want to upload a file via the Sling POST servlet, you can do so directly. The servlet will take the binary and create the proper nt:file structure: http://sling.apache.org/site/manipulating-content-the-slingpostservlet-servletspost.html#ManipulatingContent-TheSlingPostServlet%28servlets.post%29-FileUploads With curl you can pass a file parameter using the @ symbol, eg. "[email protected]". > I saved a file using a text editor into the webdav system, when I browse this > url: > > http://localhost:8080/sling/content/SimpleData.xml > > I get this xml: > > <SimpleData jcr:primaryType="nt:file" > jcr:created="2010-06-14T11:58:44.686-04:00" jcr:createdBy="admin"> > <jcr:content jcr:primaryType="nt:resource" > jcr:uuid="6506b4c2-ad52-4ff2-bf16-90c17311e8ad" > jcr:data="VGVzdCBvZiBkYXRhIGluIGEgZmlsZS4g" > jcr:lastModified="2010-06-14T11:58:44.750-04:00" jcr:lastModifiedBy="admin" > jcr:mimeType="text/plain"/> > </SimpleData> Note that XML files get a special handling in Jackrabbits/Slings standard webdav servlet, in that they are exported as xml and not as binary. See the jackrabbit mailing list, for example here: http://markmail.org/message/hctkq6looial7xzr This doesn't apply to other mime types of nt:files. Regards, Alex > > When I loaded a node using this curl > > curl -F"sling:resourceType=foo/bar" -F"title=some title" > http://admin:ad...@localhost:8080/sling/content/mynode > > It looks like this: > <mynode jcr:primaryType="nt:unstructured" sling:resourceType="foo/bar" > title="some title"/> > > > I'd like to get the XML to look like this: > > <mynode jcr:primaryType="nt:file" sling:resourceType="foo/bar" title="some > title"/> > > So I tried this: > > curl -F"sling:resourceType=foo/bar" -F"jcr:primaryType=Sling:file" > -F"jcr:title=node3" http://admin:ad...@localhost:8080/sling/content/node3 > > foo.html > > but still got this: > > <node3 jcr:primaryType="nt:unstructured" jcr:title="node3" > sling:resourceType="foo/bar"/> > > > In each case the jcr:primaryType stayed nt:unstructured, obviously I'm > missing some important point. > > > > Tony > > On Jun 14, 2010, at 12:41 PM, Justin Edelson wrote: > >> On 6/14/10 12:37 PM, Tony Giaccone wrote: >>> >>> >>> I notice when I use curl to insert a new record, it always ends up with >>> jcr:primaryType="nt:unstructured". >>> >>> >>> Is it possible to set that value when using curl? >>> >>> >>> >>> Tony Giaccone >> -Fjcr:primaryType=[your primary type] >> >> i.e. >> curl -Fjcr:primaryType=sling:Folder >> http://admin:ad...@localhost:8888/test/content >> >> mixins are the same: >> >> curl -Fjcr:primaryType=sling:Folder -Fjcr:mixinTypes=mix:referenceable >> http://admin:ad...@localhost:8888/test/content2 >> >> Justin > > -- Alexander Klimetschek [email protected]
