| 507 | **********************************************************************/ |
| 508 | |
| 509 | int msPrepareWFSLayerRequest(int nLayerId, mapObj *map, layerObj *lp, |
| 510 | httpRequestObj *pasReqInfo, int *numRequests) |
| 511 | { |
| 512 | #ifdef USE_WFS_LYR |
| 513 | char *pszURL = NULL; |
| 514 | const char *pszTmp; |
| 515 | rectObj bbox; |
| 516 | int nTimeout; |
| 517 | int nStatus = MS_SUCCESS; |
| 518 | msWFSLayerInfo *psInfo = NULL; |
| 519 | int bPostRequest = 0; |
| 520 | wfsParamsObj *psParams = NULL; |
| 521 | char *pszHTTPCookieData = NULL; |
| 522 | |
| 523 | |
| 524 | if (lp->connectiontype != MS_WFS || lp->connection == NULL) |
| 525 | return MS_FAILURE; |
| 526 | |
| 527 | /* ------------------------------------------------------------------ |
| 528 | * Build a params object that will be used by to build the request, |
| 529 | this will also set layer projection and compute BBOX in that projection. |
| 530 | * ------------------------------------------------------------------ */ |
| 531 | psParams = msBuildRequestParams(map, lp, &bbox); |
| 532 | if (!psParams) |
| 533 | return MS_FAILURE; |
| 534 | |
| 535 | /* -------------------------------------------------------------------- */ |
| 536 | /* Depending on the metadata wfs_request_method, build a Get or */ |
| 537 | /* a Post URL. */ |
| 538 | /* If it is a Get request the URL would contain all the parameters in*/ |
| 539 | /* the string; */ |
| 540 | /* If it is a Post request, the URL will only contain the */ |
| 541 | /* connection string comming from the layer. */ |
| 542 | /* -------------------------------------------------------------------- */ |
| 543 | if ((pszTmp = msOWSLookupMetadata(&(lp->metadata), |
| 544 | "FO", "request_method")) != NULL) |
| 545 | { |
| 546 | if (strncmp(pszTmp, "GET", 3) ==0) |
| 547 | { |
| 548 | pszURL = msBuildWFSLayerGetURL(map, lp, &bbox, psParams); |
| 549 | if (!pszURL) |
| 550 | { |
| 551 | /* an error was already reported. */ |
| 552 | return MS_FAILURE; |
| 553 | } |
| 554 | } |
| 555 | } |
| 556 | /* else it is a post request and just get the connection string */ |
| 557 | if (!pszURL) |
| 558 | { |
| 559 | bPostRequest = 1; |
| 560 | pszURL = msStrdup(lp->connection); |
| 561 | } |
| 562 | |
| 563 | |
| 564 | /* ------------------------------------------------------------------ |
| 565 | * check to see if a the metadata wfs_connectiontimeout is set. If it is |
| 566 | * the case we will use it, else we use the default which is 30 seconds. |
no test coverage detected