[mapserver-commits] r9972 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Mar 22 10:32:23 EDT 2010


Author: assefa
Date: 2010-03-22 10:32:22 -0400 (Mon, 22 Mar 2010)
New Revision: 9972

Modified:
   trunk/mapserver/mapows.h
   trunk/mapserver/mapwfs.c
Log:
wfs 1.1.0: add support for acceptversions parameter

Modified: trunk/mapserver/mapows.h
===================================================================
--- trunk/mapserver/mapows.h	2010-03-22 14:18:49 UTC (rev 9971)
+++ trunk/mapserver/mapows.h	2010-03-22 14:32:22 UTC (rev 9972)
@@ -110,6 +110,7 @@
   char *pszResultType;
   char *pszPropertyName;
   int nStartIndex;
+  char *pszAcceptVersions;
 } wfsParamsObj;
 
 /*

Modified: trunk/mapserver/mapwfs.c
===================================================================
--- trunk/mapserver/mapwfs.c	2010-03-22 14:18:49 UTC (rev 9971)
+++ trunk/mapserver/mapwfs.c	2010-03-22 14:32:22 UTC (rev 9972)
@@ -36,7 +36,7 @@
 #include "cpl_minixml.h"
 
 #include "mapogcfilter.h"
-
+#include "mapowscommon.h"
 /*
 ** msWFSException()
 **
@@ -520,9 +520,41 @@
 
   int i=0, tmpInt=0;
 
+  /* acceptversions: do OWS Common style of version negotiation */
+  if (wfsparams->pszAcceptVersions && strlen(wfsparams->pszAcceptVersions) > 0)
+  {     
+      char **tokens;
+      int i, j;
+
+      tokens = msStringSplit(wfsparams->pszAcceptVersions, ',', &j);
+      for (i=0; i<j;i++) 
+      {
+          int iVersion = 0;
+        
+          iVersion = msOWSParseVersionString(tokens[i]);
+
+          if (iVersion == -1) {
+              msSetError(MS_WFSERR, "Invalid version format.", "msWFSGetCapabilities()", tokens[i]);
+              msFreeCharArray(tokens, j);
+              return msWFSException(map, "acceptversions", "VersionNegotiationFailed",wmtver);
+          }
+
+          /* negotiate version */
+          tmpInt = msOWSCommonNegotiateVersion(iVersion, wfsSupportedVersions, wfsNumSupportedVersions);
+          if (tmpInt != -1)
+            break;
+      }
+       msFreeCharArray(tokens, j);
+       if(tmpInt == -1)
+       {
+           msSetError(MS_WFSERR, "ACCEPTVERSIONS list (%s) does not match supported versions", "msWFSGetCapabilities()", wfsparams->pszAcceptVersions);
+           return msWFSException(map, "acceptversions", "VersionNegotiationFailed",wmtver);
+       }
+  }
+  else
   /* negotiate version */
-  tmpInt = msOWSNegotiateVersion(msOWSParseVersionString(wfsparams->pszVersion), wfsSupportedVersions, 
-                                 wfsNumSupportedVersions);
+    tmpInt = msOWSNegotiateVersion(msOWSParseVersionString(wfsparams->pszVersion), wfsSupportedVersions, 
+                                   wfsNumSupportedVersions);
 
   /* set result as string and carry on */
   if (wfsparams->pszVersion)
@@ -2483,6 +2515,8 @@
           free(wfsparams->pszSrs);
         if (wfsparams->pszResultType)
           free(wfsparams->pszResultType);
+        if (wfsparams->pszAcceptVersions)
+          free(wfsparams->pszAcceptVersions);
     }
 }
 
@@ -2541,11 +2575,16 @@
                 else if (strcasecmp(request->ParamNames[i], "OUTPUTFORMAT") == 0)
                   wfsparams->pszOutputFormat = strdup(request->ParamValues[i]);
 
-                 else if (strcasecmp(request->ParamNames[i], "FEATUREID") == 0)
+                else if (strcasecmp(request->ParamNames[i], "FEATUREID") == 0)
                   wfsparams->pszFeatureId = strdup(request->ParamValues[i]);
                 
                 else if (strcasecmp(request->ParamNames[i], "PROPERTYNAME") == 0)
                   wfsparams->pszPropertyName = strdup(request->ParamValues[i]);
+                
+                else if (strcasecmp(request->ParamNames[i], "ACCEPTVERSIONS") == 0)
+                  wfsparams->pszAcceptVersions = strdup(request->ParamValues[i]);
+
+                
             }
         }
         /* version is optional is the GetCapabilities. If not */



More information about the mapserver-commits mailing list