2 Replies Latest reply on Feb 19, 2013 10:39 AM by mylos78

    Beginner: retrieving a file from the Repository

    mylos78

      I need to store files in the JCR repository. I have followed the documentation ("Storing files and folders") which is quite clear. I wonder, once I have successfully stored the files in the repository, which is the correct way to retrieve the node (containing the file) ? I'd need to display the document to the user: should I use the Query API in order to navigate in the repository and get the file ?

      Thanks

      Mylos

        • 1. Re: Beginner: retrieving a file from the Repository
          rhauch

          No, you cannot retrieve the BINARY property values via query row results. If you are using queries to find the "nt:file" or "nt:resource" nodes (based upon some criteria), you can use the JCR API to get the actual Node objects that correspond to the query row results, and from there you can get the named property, its BINARY value, and the value's InputStream.

           

          However, if you're just trying to get a particular BINARY value at some path, it's far more efficient to simply navigate to the Node and get the property's BINARY value (and its InputStream).

           

          UPDATE: I've added a "Reading the content" section to the Storing files and folders page.

          • 2. Re: Beginner: retrieving a file from the Repository
            mylos78

            Thanks!!!

            Everything looks quite clear now!

            Regards

            Mylos