9 Replies Latest reply on Sep 11, 2012 10:03 AM by Grigory Kalabin

    Rest api: unable to unpublish node

    Grigory Kalabin Newbie

      I'm using ModeShape 2.8.2 and JBoss 7.1.1. ModeShape rest server deployed as usual web application. And I have a kind of a stupid question.

      I can to publish a file - it uploads to the storage and everything is fine.

      But when I try to unpublish - I have an exception.

      According to the api I have to provide workspace, path and file as parameters. But how to combine path and file parameters?

      For example, I want to unpublish node at /repo/file path. The following code not working:

      File file = new File("file");
      Status status = restClient.unpublish(workspace, "/repo", file);
      

       

      log:

      12:53:26,163 ERROR [org.modeshape.web.jcr.rest.client.json.JsonRestClient] (http--127.0.0.1-8080-1) response code=405 method=unpublish
      12:53:26,166 ERROR [com.demo.app.Controller](http--127.0.0.1-8080-1) The file "C:\jboss-as-7.1.1.Final\bin\file" could not be unpublished in 
      workspace "workspace1" at path "/repo".: java.lang.RuntimeException: The file "file" could not be unpublished in workspace "workspace1" at path "/repo".
      

       

      But an url from

      (new FileNode(workspace,"/repo",file)).getUrl()

       

      is correct and get/delete requests works as expected.

       

      Also I tried:

      File file = new File("/repo/file");
      Status status = restClient.unpublish(workspace, "/", file); // if set "" instead of "/" result the same
      

      But an url from getUrl method is wrong.

      Thank you for any help.