Thanks Rajith, now it makes sense. On Mon, Nov 17, 2014 at 4:21 AM, Rajith Vitharana <raji...@wso2.com> wrote:
> Hi Himasha, > > There too you are attaching content as a part of string('RESULT'+ > result.content), so the content get logged, which is the same case as > earlier. I tried to find out the type of the content object as follows and > it showed that it's a "stream" object. > > log.info('CONTENT type ++++ ' + > Object.prototype.toString.call(result.content)); > > Thanks, > > On Sat, Nov 15, 2014 at 10:15 PM, Himasha Guruge <himas...@wso2.com> > wrote: > >> Hi Rajith, >> >> Just a quick note in case it worked for you. When I try to retrieve the >> content using another ajax GET call, the print() doesn't display anything. >> But the value is logged as expected. The code is as follows. >> >> if(type=="GET") >> { >> var path = '/_system/governance/'+processName; >> var result=userReg.get(path); >> var output= result.content; >> >> print(output); >> log.info('RESULT'+ result.content); >> >> >> >> } >> >> Also I tried to print other properties of the resource such as >> 'result.description' and the value gets printed. Please find the attached >> .jag file. Am I doing something wrong here? >> >> Thanks, & Regards, >> Himasha >> >> On Sun, Nov 16, 2014 at 8:35 AM, Himasha Guruge <himas...@wso2.com> >> wrote: >> >>> Hi Rajith, >>> >>> Thanks a lot, it worked. >>> >>> Thanks & Regards, >>> >>> On Sun, Nov 16, 2014 at 3:49 AM, Rajith Vitharana <raji...@wso2.com> >>> wrote: >>> >>>> 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/ >>>> >>> >>> >>> >>> -- >>> 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/ > -- 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