Ignore:
Timestamp:
Mar 5, 2016, 2:37:06 PM (9 years ago)
Author:
djay
Message:

Add optional CORS support. Fix issue when dealing with Array in JavaScript? support.

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

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/doc/index.dox

    r608 r752  
    1313Home: http://www.zoo-project.org<br>
    1414Download:
    15  <a href="http://zoo-project.org/site/Downloads#Downloads">http at zoo-project.org</a>,
    16  <a href="http://zoo-project.org/site/Downloads#Fordevelopers">svn at zoo-project.org</a>
     15 <a href="http://zoo-project.org/Code/Download">http at zoo-project.org</a>,
     16 <a href="http://svn.zoo-project.org/svn/">svn at zoo-project.org</a>
    1717
    1818This documentation describes the ZOO-Project C-API. You can start your visit by the Data Structures link above which details all available structures in ZOO-Project. The Files link presents all source files used to generate this documentation.
  • trunk/zoo-project/zoo-kernel/service_internal_js.c

    r640 r752  
    458458  while(isArray==NULL && tmpm!=NULL){
    459459    jsval jsstr;
    460     if((isBinary!=NULL && strncasecmp(tmpm->name,"value",5)==0))
     460    if(isBinary!=NULL && strncasecmp(tmpm->name,"value",5)==0)
    461461      jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm->value,atoi(isBinary->value)));
    462462    else
     
    473473    JSObject* values=JS_NewArrayObject( cx, cnt, NULL );
    474474    JSObject* mvalues=JS_NewArrayObject( cx, cnt, NULL );
    475     map *tmpm1,*tmpm2;
     475    map *tmpm1,*tmpm2,*tmpm3;
    476476    int i=0;
    477477    for(i=0;i<cnt;i++){
    478478      tmpm1=getMapArray(t,"value",i);
    479479      tmpm2=getMapArray(t,tmap->name,i);
     480      tmpm3=getMapArray(t,"size",i);
    480481      if(tmpm1!=NULL){
    481         jsval jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm1->value,strlen(tmpm1->value)));
     482        jsval jsstr;
     483        if(tmpm3!=NULL)
     484          jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm1->value,atoi(tmpm3->value)));
     485        else
     486          jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm1->value,strlen(tmpm1->value)));
    482487        JS_SetElement( cx, values, i, &jsstr );
    483488      }
     
    491496    JS_SetProperty(cx, res,"value",&jvalues);
    492497    JS_SetProperty(cx, res,tmap->name,&jmvalues);
     498    while(tmpm!=NULL){
     499      if(strncasecmp(tmpm->name,"value",5)!=0 && strncasecmp(tmpm->name,"size",4)!=0 && strncasecmp(tmpm->name,tmap->name,strlen(tmap->name))!=0){
     500        jsval jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm->value,strlen(tmpm->value)));
     501        JS_SetProperty(cx, res, tmpm->name,&jsstr);
     502      }
     503#ifdef JS_DEBUG
     504      fprintf(stderr,"[JS] %s => %s\n",tmpm->name,tmpm->value);
     505#endif
     506      tmpm=tmpm->next;
     507    }
    493508  }
    494509  return res;
  • trunk/zoo-project/zoo-kernel/service_internal_ms.c

    r640 r752  
    958958        }
    959959      }
     960      else{
     961        if(nBandsI==1){
     962          myLayer->offsite.red=0;
     963          myLayer->offsite.green=0;
     964          myLayer->offsite.blue=0;
     965        }
     966        msLayerAddProcessing(myLayer,"RESAMPLE=BILINEAR");
     967      }
    960968    }
    961969    if( strlen(GDALGetRasterUnitType(hBand)) > 0 ){
  • trunk/zoo-project/zoo-kernel/service_internal_saga.c

    r653 r752  
    559559  }
    560560  else{
     561#ifdef HAVE_LIBKML
    561562    addToMap(arg,"FORMAT","LIBKML");
     563#else
     564    addToMap(arg,"FORMAT","KML");
     565#endif
    562566  }
    563567  free(fext);
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r745 r752  
    10241024      setMapInMaps(m,"main","serverAddress",tmpUrl);
    10251025    }
     1026
     1027  // CORS Support
     1028  if(strncasecmp(cgiRequestMethod,"OPTIONS",7)==0){
     1029    map* cors=getMapFromMaps(m,"main","cors");
     1030    if(cors!=NULL && strncasecmp(cors->value,"true",4)==0){
     1031      char *encoding=getEncoding(m);
     1032      printHeaders(m);
     1033      printf("Content-Type: text/plain; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);
     1034      printf(_("CORS is enabled.\r\n"));
     1035      freeMaps (&m);
     1036      free (m);
     1037      fflush (stdout);
     1038      return 3;
     1039    }
     1040  }
    10261041
    10271042  //Check for minimum inputs
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