I managed to go a little further by commenting out the new 
TypeValidatorProvider() in oak-run 
Main.HttpServer#createDefaultValidatorProvider (line 223) which prevented me to 
create anything just because no node type is registered.
Then with the following I could add some content:
  http -f -v -a admin:admin http://localhost:8080/ < samplenode.json 
where 
  samplenode.json is 
{"test2" : 
  {
   "jcr:primaryType" : "nt:unstructured",
   "name" : "some other name"
   }
}

Maybe adding a small set of node types (the default ones nt:*) would help to 
prevent having to do this workaround.
Hope this helps,
Tommaso


On 25/gen/2013, at 12:51, Tommaso Teofili wrote:

> Hi all,
> 
> I'm trying to access an Oak repository over HTTP as explained at [1] so I 
> assumed I had to use oak-run as explained at [2].
> 
> If I try with curl:
> curl -d foo=bar http://localhost:8080/test
> 
> I get:
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
> <title>Error 500 String index out of range: -1</title>
> </head>
> <body>
> <h2>HTTP ERROR: 500</h2>
> <p>Problem accessing /test. Reason:
> <pre>    String index out of range: -1</pre></p>
> <hr /><i><small>Powered by Jetty://</small></i>
> ...
> 
> If I try with httpie:
> http -b http://localhost:8080/ test:={}
> 
> I get:
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
> <title>Error 500 Cannot add node 'test' at /</title>
> </head>
> <body>
> <h2>HTTP ERROR: 500</h2>
> <p>Problem accessing /. Reason:
> <pre>    Cannot add node 'test' at /</pre></p>
> <hr /><i><small>Powered by Jetty://</small></i>
> 
> or trying:
> http POST http://localhost:8080/node name=John
> 
> I get:
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
> <title>Error 500 String index out of range: -1</title>
> </head>
> <body>
> <h2>HTTP ERROR: 500</h2>
> <p>Problem accessing /node. Reason:
> <pre>    String index out of range: -1</pre></p>
> <hr /><i><small>Powered by Jetty://</small></i>
> 
> So neither using httpie nor using curl I can create a node, is the wiki 
> outdated or am I missing something?
> 
> The StringIndexOutOfRange seems to be due to the missing final slash on the 
> sent URL (http://localhost:8080/test) so I wonder if that's a bug.
> 
> Thanks in advance,
> Tommaso
> 
> [1] : http://wiki.apache.org/jackrabbit/Oak-over-HTTP
> [2] : http://markmail.org/message/vq52qfhpdyqr2ojv

Reply via email to