1 Reply Latest reply on Aug 17, 2012 6:12 AM by Horia Chiorean

    Streaming content to modeshape using the REST API ?

    Akram Ben Aissi Newbie

      Hi modeshapers,


      I am still going deep in the modeshape REST API, and now I came across a feature that I really really want to have, which is the ability to add nodes in a streaming way instead of sending full content as JSon.

      To sum up the issue:

      When started with the client API, I rapidly faced JavaHeapSpace errors  when trying to deal with files larger than 10MB, because I was using a small configured heap size. However, even putting it larger I will end with the issue over and over.

      This issue was due to the fact that the file content is encoded in Base64 at a certain time, and since this is done in memory, it get exhausted, and the transfer ends up.

      I started then to extend the initialy used HttpClientConnection to make it now able to handle an InputStream instead of a String. And I tried to make it live with the other components of the modeshape rest api to avoid breaking other parts of my code.


      The result seems to begin working, since, the content of the file is streamed, and the request reach the server,  but the content is empty.

      So this leads me to my next issue, which is that the server side API needs also to be modified to handle inputStream as a parameter.


      I am quite stuck here, cause that may require me more time to implement this feature. Because, that may require a important refactor of the JSON API to make handle stream as well.


      So, does anybody here have any pointer or advices from where to start?

      Other question: Is the REST API planned for migration and support on modeshape 3.0 ? if "probably not", do I have other solutions to handle this kind of feature?