Changeset 403


Ignore:
Timestamp:
Mar 27, 2013, 9:32:42 PM (11 years ago)
Author:
djay
Message:

Fixing issue pointed by Luca today about JS service.

Location:
trunk/zoo-project/zoo-kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service_internal.c

    r393 r403  
    12151215  nc = xmlNewNode(ns, BAD_CAST "Process");
    12161216  map* tmp2=getMap(serv->content,"processVersion");
    1217 
    12181217  if(tmp2!=NULL)
    12191218    xmlNewNsProp(nc,ns,BAD_CAST "processVersion",BAD_CAST tmp2->value);
    12201219 
    12211220  printDescription(nc,ns_ows,serv->name,serv->content);
    1222   //fflush(stderr);
    12231221
    12241222  xmlAddChild(n,nc);
     
    13391337      scursor=getElements(serv->outputs,mcursor->name);
    13401338      if(scursor!=NULL){
    1341         if(testResponse==NULL)
     1339        if(testResponse==NULL || tmp0==NULL)
    13421340          printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output");
    13431341        else
    1344           if(strncmp(tmp0->value,"true",4)==0)
     1342          if(tmp0!=NULL && strncmp(tmp0->value,"true",4)==0)
    13451343            printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output");
    13461344      }
  • trunk/zoo-project/zoo-kernel/service_internal_js.c

    r384 r403  
    112112
    113113  /* Create the global object. */
    114   //#ifdef JS_NewCompartmentAndGlobalObject
    115114  global = JS_NewCompartmentAndGlobalObject(cx, &global_class, NULL);
    116   //#else
    117   //global = JS_NewObject(cx, &global_class, 0,0);
    118   //#endif
    119115
    120116  /* Populate the global object with the standard globals,
     
    124120  }
    125121
     122  /* Define specific function and global variable to share with JS runtime
     123   */
    126124  jsval tmp=INT_TO_JSVAL(3);
    127125  if (!JS_SetProperty(cx, global, "SERVICE_SUCCEEDED", &tmp))
     
    385383    fprintf(stderr,"Array Object is NULL!\n");
    386384  maps* tmp=t;
    387 
    388385  while(tmp!=NULL){
    389386    jsuint len;
     
    392389    jsval pvalj=OBJECT_TO_JSVAL(pval);
    393390    JS_SetProperty(cx, res, tmp->name, &pvalj);
    394 
    395391#ifdef JS_DEBUG
    396392    fprintf(stderr,"Length of the Array %d, element : %s added \n",len,tmp->name);
     
    408404  map* isBinary=getMap(t,"size");
    409405  map* tmap=getMapType(t);
    410 #ifdef DEBUG
     406#ifdef JS_DEBUG
    411407  if(tmap==NULL)
    412408    fprintf(stderr,"tmap is null !\n");
     
    414410    fprintf(stderr,"tmap is not null ! (%s = %s)\n",tmap->name,tmap->value);
    415411#endif
    416   /* Avoid gesture of binary content which failed due to strlen function use */
    417   if(isBinary!=NULL){
    418     return res;
    419   }
    420   while(tmpm!=NULL){
    421     if(isArray==NULL || strncasecmp(tmpm->name,"value",5)!=0 ||
    422        (tmap!=NULL && strncasecmp(tmpm->name,tmap->name,strlen(tmap->name))!=0)){
    423       jsval jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm->value,strlen(tmpm->value)));
     412  if(isArray==NULL){
     413    while(tmpm!=NULL){
     414      jsval jsstr;
     415      if(isBinary!=NULL && strncasecmp(tmpm->name,"value",5)==0)
     416        jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm->value,atoi(isBinary->value)));
     417      else
     418        jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm->value,strlen(tmpm->value)));
    424419      JS_SetProperty(cx, res, tmpm->name,&jsstr);
    425420#ifdef JS_DEBUG
    426       fprintf(stderr,"%s => %s\n",tmpm->name,tmpm->value);
    427 #endif
    428     }
    429     tmpm=tmpm->next;
    430   }
    431   if(isArray!=NULL){
     421      fprintf(stderr,"[JS] %s => %s\n",tmpm->name,tmpm->value);
     422#endif
     423      tmpm=tmpm->next;
     424    }
     425  }
     426  else{
    432427    map* len=getMap(t,"length");
    433428    int cnt=atoi(len->value);
     
    515510        free(tres);
    516511        tres=NULL;
    517        
    518        
     512               
    519513      }
    520514    }
     
    604598          fprintf(stderr,"JSVAL NVP1J IS NOT OBJECT !!\n");
    605599#endif
    606 
    607600      }
    608601#ifdef JS_DEBUG
  • trunk/zoo-project/zoo-kernel/zoo_loader.c

    r381 r403  
    198198      xmlInitParser();
    199199      xmlDocPtr doc = xmlParseMemory(t1->value,cgiContentLength);
    200 
    201200      {
    202201        xmlXPathObjectPtr reqptr=extractFromDoc(doc,"/*[local-name()='Envelope']/*[local-name()='Body']/*");
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png