5 Replies Latest reply on Jan 2, 2014 11:39 AM by Randall Hauch

    Problem setting properties via REST interface

    Skyler Magnuson Newbie

      Hey, I'm pretty new to using ModeShape, right now I'm trying to run through tutorials and get things working. I was able to run an in-process ModeShapeEngine and things seemed to work. But then I tried to use the REST interface, following REST Service 3.x - ModeShape 3 - Project Documentation Editor , and I am seemingly unable to create properties. I've tried all the variants of PUT/POST that I can think of, but an example of a command that doesn't create properties:

       

      curl -u admin:admin -v -X POST http://localhost:8080/modeshape-rest/sample/default/items/test -H "Content-Type:application/json" -H "Accept:text/plain" -D '{"jcr:primaryType":"nt:unstructured","testProperty":"testValue","multiValuedProperty":["value1","value2"],"children":{"childNode":{"nestedProperty":"nestedValue"}}}'

      * About to connect() to localhost port 8080 (#0)

      *   Trying 127.0.0.1... connected

      * Connected to localhost (127.0.0.1) port 8080 (#0)

      * Server auth using Basic with user 'admin'

      > POST /modeshape-rest/sample/default/items/test HTTP/1.1

      > Authorization: Basic YWRtaW46YWRtaW4=

      > User-Agent: curl/7.18.1 (i686-pc-linux-gnu) libcurl/7.18.1 OpenSSL/0.9.8b zlib/1.2.3

      > Host: localhost:8080

      > Content-Type:application/json

      > Accept:text/plain

      >

      < HTTP/1.1 201 Created

      < Server: Apache-Coyote/1.1

      < Content-Type: text/plain;charset=utf-8

      < Content-Length: 250

      < Date: Wed, 30 Oct 2013 01:07:37 GMT

      <

      {

        "self": "http:\/\/localhost:8080\/modeshape-rest\/sample\/default\/items\/test",

        "up": "http:\/\/localhost:8080\/modeshape-rest\/sample\/default\/items\/",

        "id": "498fd659-9ebf-445b-996f-639bede25e2d",

        "jcr:primaryType": "nt:unstructured"

      * Connection #0 to host localhost left intact

      * Closing connection #0

      }

       

      If you look at the response document, it doesn't contain "testProperty" or "multiValuedProperty". And subsequent GETs to this resource do not show it either. At first I was running this on Tomcat with a WAR that I was building myself, but when I couldn't figure out this issue I switched to running ModeShape inside of EAP, following the guide Installing ModeShape into EAP - ModeShape 3 - Project Documentation Editor . I basically installed EAP 6.1.0 Alpha, unzipped the ModeShape subsystem zip file into $JBOSS_HOME, and then started EAP with

       

      bin/standalone.sh -c standalone-modeshape.xml

       

      I've tried this with both 3.5.0 Final and 3.6.0 Final ModeShape subsystems, and was consistently unable to create properties. This is happening for both "artifact" and "example" repositories (I've always used the "default" workspace). And the most bizarre thing is that I see files getting created in $JBOSS_HOME and $CATALINA_HOME with names similar to the properties map that I'm trying to create. The above command results in the creation of the file

       

      $JBOSS_HOME/{"jcr:primaryType":"nt:unstructured","testProperty":"testValue","multiValuedProperty":["value1","value2"],"children":{"childNode":{"nestedProperty":"nestedValue"}}}

       

      cat {*

      HTTP/1.1 201 Created

      Server: Apache-Coyote/1.1

      Content-Type: text/plain;charset=utf-8

      Content-Length: 263

      Date: Wed, 30 Oct 2013 01:14:53 GMT