Changeset 88 for trunk/zoo-kernel


Ignore:
Timestamp:
Jan 26, 2011, 4:13:35 PM (14 years ago)
Author:
djay
Message:

Special thanks to Soeren Gebbert for his proposals. Add the inRequest key to the inputs/outputs maps for specifying if an input/output was present in the request or not (required to remove the PyXB dependency from GRASS Support). Add the automatic base64 decoding for input provided as base64 encoded string, in this case a size key will be added (containing the size of the decoded string which is probably a binary file), base64_value will be added to store the original base64 string for possible acces from service function, value will finally contain the decoded string (this was required for supporting requests coming from the QGIS WPS Client).

Location:
trunk/zoo-kernel
Files:
3 edited

Legend:

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

    r87 r88  
    17581758}
    17591759
     1760char *base64d(unsigned char *input, int length,int* red)
     1761{
     1762  BIO *b64, *bmem;
     1763
     1764  char *buffer = (char *)malloc(length);
     1765  memset(buffer, 0, length);
     1766
     1767  b64 = BIO_new(BIO_f_base64());
     1768  bmem = BIO_new_mem_buf(input, length);
     1769  bmem = BIO_push(b64, bmem);
     1770
     1771  *red=BIO_read(bmem, buffer, length);
     1772
     1773  BIO_free_all(bmem);
     1774
     1775  return buffer;
     1776}
     1777
     1778void ensureDecodedBase64(maps **in){
     1779  maps* cursor=*in;
     1780  while(cursor!=NULL){
     1781    map *tmp=getMap(cursor->content,"encoding");
     1782    if(tmp!=NULL && strncasecmp(tmp->value,"base64",6)==0){
     1783      tmp=getMap(cursor->content,"value");
     1784      addToMap(cursor->content,"base64_value",tmp->value);
     1785      char *s=strdup(tmp->value);
     1786      free(tmp->value);
     1787      int size=0;
     1788      tmp->value=base64d(s,strlen(s),&size);
     1789      char sizes[1024];
     1790      sprintf(sizes,"%d",size);
     1791      addToMap(cursor->content,"size",sizes);
     1792    }
     1793    cursor=cursor->next;
     1794  }
     1795}
     1796
    17601797char* addDefaultValues(maps** out,elements* in,maps* m,int type){
    17611798  elements* tmpInputs=in;
     
    18021839        }
    18031840      }
     1841      addToMap(tmpMaps2->content,"inRequest","false");
    18041842      if(type==1){
    18051843        map *tmpMap=getMap(tmpMaps2->content,"value");
     
    18231861      iotype* tmpIoType=getIoTypeFromElement(tmpInputs,tmpInputs->name,
    18241862                                             tmpMaps->content);
    1825 
     1863      addToMap(tmpMaps->content,"inRequest","true");
    18261864      if(type==0) {
    18271865        /**
  • trunk/zoo-kernel/service_internal.h

    r76 r88  
    107107
    108108  char *base64(const unsigned char*,int);
     109  char *base64d(unsigned char*,int,int*);
     110  void ensureDecodedBase64(maps**);
    109111
    110112  char* addDefaultValues(maps**,elements*,maps*,int);
  • trunk/zoo-kernel/zoo_service_loader.c

    r76 r88  
    16481648  addDefaultValues(&request_output_real_format,s1->outputs,m,1);
    16491649
     1650  ensureDecodedBase64(&request_input_real_format);
     1651
    16501652#ifdef DEBUG
    16511653  fprintf(stderr,"REQUEST_INPUTS\n");
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