Hi,
I would like to create an nt:file node in the root directory of my
repository using the PostServlet, but as far as my investigation goes, it is
impossible if I want this nt:file node to have a typical file name such as
"test.css" as the node name, because the SlingPost servlet will strip out
extensions and selectors for non-existing resources. So if I am using
following formdata:

<form method="POST" action="/test.css">
<input type="hidden" value="/test.css" name=":redirect"/>
<input type="hidden" value="nt:file" name="jcr:primaryType"/>
<input type="hidden" value="nt:resource"
name="jcr:content/jcr:primaryType"/>
<input type="hidden" value="text/css" name="jcr:content/jcr:mimeType"/>
<input type="hidden" value="" name="jcr:content/jcr:lastModified"/>

I end up having a node /test, but no /test.css (as I specified in the action
attribute). From my point of view Sling is trying to be too smart for me, as
it finds out what I want through ignoring what I say what I want.

If I now turn to a more awkward way of specifying the resource I want to
create (ignoring the way HTML says it should be done) using the non-standard
:name parameter and /* action like that:

<form method="POST" action="/*">
<input type="hidden" value="/test.css" name=":redirect"/>
<input type="hidden" value="test.css" name=":name"/>
<input type="hidden" value="nt:file" name="jcr:primaryType"/>
<input type="hidden" value="nt:resource"
name="jcr:content/jcr:primaryType"/>
<input type="hidden" value="text/css" name="jcr:content/jcr:mimeType"/>
<input type="hidden" value="" name="jcr:content/jcr:lastModified"/>

I find myself with a NullPointerException, because in
AbstractSlingPostOperation:72 ResourceUtil.getParent("/") returns null,
which causes a NullPointerException later on in the externalizePath method.

In the end I find myself unable to create nodes with the name I wish and
would like to ask the developers to sort out
- why the resource URL is ignored when creating content
- if the parent of "/" is really null
- how to externalize a null path

thank you very much,

Lars

Reply via email to