cancel
Showing results for 
Search instead for 
Did you mean: 

Using SimpleHttpConnection from Webscripts

jon81
Champ in-the-making
Champ in-the-making
I am trying to use SimpleHttpConnection to retrieve content (from a remote server) in a webscript and write it to a content node.

my code looks like:

simplehttpresult = SimpleHttpConnection.getContent(url);
content.properties.content.write(simplehttpresult);

The error I get in the logs is:

Error: InternalError: Can't find method org.alfresco.repo.jscript.ScriptNode$ScriptContentData.write(java.lang.String).


So I guess my question is, how do I caste a String to a ScriptContent object (or whatever format it needs to be in)?
2 REPLIES 2

mitpatoliya
Star Collaborator
Star Collaborator
First of all you need to make sure you have proper content node.
once you have the reference of that node let's say "tempnode"
you can write in that like this

var contentStr="this is for test";
tempnode.properties.content=contentStr;

jon81
Champ in-the-making
Champ in-the-making
Thankyou for the reply. The problem is the data is binary. Also the remote server is not alfresco. (I probably should have mentioned that)

Is this possible?