Changeset 752


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

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

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/kernel/configuration.rst

    r725 r752  
    4343    msOgcVersion=1.0.0
    4444    tmpUrl=http:/localhost/temp/
     45    cors=false
    4546   
    4647    [identification]
     
    7677 * ``dataPath``: Path to the directory where data files are stored (used to store mapfiles and data when MapServer support is activated).
    7778 * ``tmpPath``: Path to the directory where temporary files are stored (such as *ExecuteResponse* when *storeExecuteResponse* is set to true).
     79 * ``tmpUrl``: URL to access the temporary files directory (cf. ``tmpPath``).
    7880 * ``cacheDir``: Path to  the directory where cached request files [#f1]_ are stored (optional).
    7981 * ``serverAddress``: URL to the ZOO-Kernel instance.
    80  * ``tmpUrl``: URL of the temporary files directory.
    8182 * ``mapservAddress``: URL to the MapServer instance (optional).
    8283 * ``msOgcVersion``: Version of all supported OGC Web Services output [#f2]_
    8384   (optional).
    8485 * ``lang``: Supported natural languages separated by a coma (the first is the default one),
     86 * ``cors``: Define if the ZOO-Kernel should support `Cross-Origin
     87   Resource Sharing <https://www.w3.org/TR/cors/>`__. If this
     88   paramater is not defined, then the ZOO-Kernel won't support CORS.
     89
     90In case you have activated the MapServer support, please refer to
     91:ref:`this specific section <kernel-mapserver-main.cfg>`.
    8592
    8693
     
    117124and notice the specific header *X-Powered-By: Zoo-Project@Trac*.
    118125
     126In case you want to allow CORS support for POST requests coming from
     127``myhost.net``, then you should define the following minimal
     128parameters in this section:
     129
     130.. code-block:: guess
     131    :linenos:
     132   
     133    Access-Control-Allow-Origin=myhost.net
     134    Access-Control-Allow-Methods=POST
     135    Access-Control-Allow-Headers=content-type
     136
     137
    119138env section
    120139...............................
     
    132151    [env]
    133152    DISPLAY=:1
     153
     154In case you have activated the OTB support, please refer to :ref:`this
     155specific section <kernel-orfeotoolbox-main.cfg>`.
    134156
    135157lenv section
  • trunk/docs/kernel/mapserver.rst

    r725 r752  
    107107     cp zoo_loader.cgi /usr/lib/cgi-bin
    108108
     109
     110.. _kernel-mapserver-main.cfg:
    109111
    110112Main configuration file
  • trunk/docs/kernel/orfeotoolbox.rst

    r725 r752  
    5757....................................
    5858
     59.. _kernel-orfeotoolbox-main.cfg:
     60   
    5961Main configuration file
    6062*************************
  • trunk/workshop/index.rst

    r725 r752  
    1212   :maxdepth: 1
    1313
     14   2015/index
    1415   2014/index
    1516   2013/index
  • trunk/zoo-project/HISTORY.txt

    r729 r752  
    1 Version 1.5.0-dev
     1Version 1.6.0-dev
     2  * Add CORS support
     3  * Fix issue when dealing with Array in JavaScript support
     4  * Update the Centos installation procedure.
     5  * Small fixes in java support.
     6  * Fix issue when XML request contains empty nodes for inputs
     7  * Add status update for contour lines computation
     8  * Fix FASTCGI location using the --with-fastcgi option.
     9  * Redefined the API function addToMapWithSize to fix problem with Python/PHP support.
     10
     11Version 1.5.0
    212  * Complete rewrite of the documentation to use modern style
    313  * Fix asynchronous POST request on WIN32 platforms
  • trunk/zoo-project/zoo-client/lib/tpl/payload_Execute.mustache

    r517 r752  
    3535                <wps:Input>
    3636                        <ows:Identifier>{{identifier}}</ows:Identifier>
    37                         <wps:Reference xlink:href="{{href}}" method="{{method}}">
     37                        <wps:Reference xlink:href="{{href}}" method="{{method}}" {{#schema}} schema="{{shema}}"{{/schema}}{{#mimeType}} mimeType="{{mimeType}}"{{/mimeType}}{{#encoding}} encoding="{{encoding}}"{{/encoding}}>
    3838{{#headers}}
    3939                          <wps:Header key="{{key}}" value="{{value}}" />
     
    6060{{#RawDataOutput}}
    6161{{#DataOutputs}}
    62     <wps:RawDataOutput mimeType="{{mimeType}}">
     62    <wps:RawDataOutput {{#mimeType}}mimeType="{{mimeType}}"{{/mimeType}}>
    6363      <ows:Identifier>{{identifier}}</ows:Identifier>
    6464    </wps:RawDataOutput>
  • 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