Hi Himasha,

Yes I tried with ES-2.0.0-SNAPSHOT. It seems, the content comes as a
stream. As you have mentioned, it gets stored correctly in the registry.
When you read it, although you can't see it in the json output you have
seen in the browser, the content is there. I tried reading the content
separately and convert it to string, and it worked for me. Read the content
and convert it to string as below,

var output = ''+result.content;

Thanks,

On Fri, Nov 14, 2014 at 8:57 PM, Himasha Guruge <himas...@wso2.com> wrote:

> Hi,
>
> A small addition, though following code gives above output, when i check
> for path location using management console, the value is stored.
>
> var result = userReg.get(path);
>
> print(result);
>
>
> Thanks & Regards,
>
> On Sat, Nov 15, 2014 at 10:18 AM, Himasha Guruge <himas...@wso2.com>
> wrote:
>
>> Hi Rajitha,
>>
>> Did you try it with ES -2.0.0-SNAPSHOT ? I tried the exact sample that is
>> provided here, but still the content and properties fields are passed as
>> empty as shown below.
>>
>> Retrived Resource : {"created" : {"author" : "admin", "time" :
>> 1416026845474}, "content" : {}, "id" : "/_system/config/wso2/sample",
>> "version" : 3885, "uuid" : "0123", "path" : "/_system/config/wso2/sample",
>> "name" : "sample", "description" : "This is a sample description",
>> "updated" : {"author" : "admin", "time" : 1416026845474}, "mediaType" :
>> "text/plain", "properties" : {}, "aspects" : {}}
>>
>> Thanks,
>>
>> On Sat, Nov 15, 2014 at 3:30 AM, Rajith Vitharana <raji...@wso2.com>
>> wrote:
>>
>>> Hi Himasha,
>>>
>>> You can try creating the resource as below
>>>
>>> var resource ={
>>>             content: 'This is a sample text.',
>>>             mediaType: 'text/plain',
>>>             description: 'This is a sample description',
>>>             uuid: '0123',
>>>             properties:{prop1: 'val1', prop2: 'val2'}
>>>         };
>>> userReg.put(path,resource);
>>>
>>> you can add the content you are retrieving from the request, inside this
>>> resource. I tried out this and it worked fine for me. Resource is correctly
>>> stored in registry. You can look in to [1] for more info.
>>>
>>> [1] - http://jaggeryjs.org/documentation.jag?api=registry
>>>
>>> Thanks,
>>>
>>> On Fri, Nov 14, 2014 at 3:04 AM, Himasha Guruge <himas...@wso2.com>
>>> wrote:
>>>
>>>> Hi All,
>>>>
>>>> For one of the tasks in my training project, I need to save xml content
>>>> in the registry. I have created a .jag file [1] under apis folder, and
>>>> trying to store the content in registry under a given path as follows.
>>>>
>>>> var path = '/_system/governance/'+processName; // path of content
>>>> var content=req.getParameter('content');  //actual xml content to be
>>>> stored
>>>> userReg.put(path,content);
>>>>
>>>> When I try to log the path[2], for attribute 'content' it is shown as
>>>> empty. Also when I check content  for the respective path using Management
>>>> console , no value is stored. But when I try to log the  content variable(
>>>> value I get from req.getParameter('content') )  value is shown which means
>>>> that  the variable has the required value in it. Just that it is not stored
>>>> in registry.
>>>>
>>>> I'm using ES-2.0.0-SNAPSHOT. Any idea  on the reason behind this?
>>>>
>>>>
>>>> [1]​​​
>>>>  chevronxml.jag
>>>> <https://docs.google.com/a/wso2.com/file/d/0B2gZ09XLMRjKMkFQc1ZJckJMNFE/edit?usp=drive_web>
>>>> ​
>>>> [2]
>>>> ​
>>>>  valueOfPath
>>>> <https://docs.google.com/a/wso2.com/file/d/0B2gZ09XLMRjKMm1aTW9CcnpLMDg/edit?usp=drive_web>
>>>> ​
>>>>
>>>> --
>>>> Himasha Guruge
>>>> *Software Engineer*
>>>> WS*O2* *Inc.*
>>>> Mobile: +94 777459299
>>>> himas...@wso2.com
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Rajith Vitharana
>>>
>>> Software Engineer,
>>> WSO2 Inc. : wso2.com
>>> Mobile : +94715883223
>>> Blog : http://lankavitharana.blogspot.com/
>>>
>>
>>
>>
>> --
>> Himasha Guruge
>> *Software Engineer*
>> WS*O2* *Inc.*
>> Mobile: +94 777459299
>> himas...@wso2.com
>>
>
>
>
> --
> Himasha Guruge
> *Software Engineer*
> WS*O2* *Inc.*
> Mobile: +94 777459299
> himas...@wso2.com
>



-- 
Rajith Vitharana

Software Engineer,
WSO2 Inc. : wso2.com
Mobile : +94715883223
Blog : http://lankavitharana.blogspot.com/
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to