1 Reply Latest reply on Nov 4, 2014 8:03 AM by hchiorean

    JCR REST API via Tomcat

    janpetzold

      I'm trying to use the REST API for my repo with a Tomcat 7 server and it doesn't work. Everything I tried so far is based on the modeshape-examples:

       

      https://github.com/ModeShape/modeshape-examples

       

      e.g. modeshape-spring-example. Now I only added the needed dependency (as mentioned in https://docs.jboss.org/author/display/MODE40/ModeShapehttps://docs.jboss.org/author/display/MODE40/ModeShapehttps://docs.jboss.org/author/display/MODE40/ModeShape) to pom.xml but nothing changes. There's no mapping to the path modeshape-rest or anything like that.

       

      Documentation also says that a "connect" role is necessary so I added this in my repository-config.json for the anonymous login:

       

      "security" : {
              "anonymous" : {
                  "roles" : ["readonly","readwrite","admin", "connect"],
                  "useOnFailedLogin" : false
              }
      
      
      
      
      

       

      But no effect. What am I missing or what do I have to do to enable the REST service API for any of the examples?

       

      UPDATE

       

      It turned out that I just did not configure the users properly. I had to add a user to tomcat, give him the role "connect" and include the dependency

       

      <dependency>

          <groupId>org.modeshape</groupId>

          <artifactId>modeshape-web-jcr-rest-war</artifactId>

          <version>${modeshape.version}</version>

          <type>war</type>

      </dependency>

       

      to my project. Afterwards I basically copied the content of the web.xml of the modeshape-web-jcr-rest-war into my "parent" web.xml and it all worked.

        • 1. Re: JCR REST API via Tomcat
          hchiorean

          Outside of Wildfly/EAP the REST service has to be deployed as part of a WAR application (which contains the appropriate artifacts). We're using this module: modeshape/web/modeshape-web-jcr-rest-war at master · ModeShape/modeshape · GitHub to unit test (via Jetty) our REST service. So you should look at that for the required dependencies/configuration.

          You have a couple of options:

          1. create a similar module (with the required dependencies - see above) in your own project.
          2. use the above artifact directly from Maven and overlay your own repository-config.json (the default one we use for testing) and/or web.xml
          1 of 1 people found this helpful