WSHelper.SplitUrl

Splits a complete URL string into pieces.

Syntax

SplitUrl( 
   url STRING )
  RETURNS ( scheme STRING,
            host STRING,
            port STRING,
            path STRING,
            query STRING )
  1. url is a STRING with the URL to be split in pieces.
  2. scheme is the URL scheme (http, https, file, ...). It includes all parts before ://
  3. host is the hostname.
  4. port : the port number, or NULL if there is none.
    Note: If NULL is returned, there is always a default port depending on the scheme: 443 for https, and 80 for http.
  5. path is the path of the URL.
  6. query is the query string of the URL, or NULL if there is none.

Usage

Splits a complete URL string into pieces.

In case of error, a NULL value will be returned.

WSHelper functions example

IMPORT FGL WSHelper

MAIN

DEFINE val, scheme, host, port, path, query STRING
DEFINE ind INTEGER
DEFINE ret WSHelper.WSQueryType

CALL WSHelper.SplitQueryString("name1=val1&name2=val2&name3=val3")
  RETURNING ret

FOR ind = 1 TO ret.getLength()
  DISPLAY "Query",ind
  DISPLAY " name is",ret[ind].name
  DISPLAY " value is ",ret[ind].value
END FOR

LET val = WSHelper.FindQueryStringValue("name1=val1&name2=val2","name1")

CALL WSHelper.SplitUrl("https://cube.strasbourg.4js.com:3128/GWS-492/TestSplitURL/test1")
  RETURNING scheme, host, port, path, query

END MAIN
Output:
Query          1
 name isname1
 value is val1
Query          2
 name isname2
 value is val2
Query          3
 name isname3
 value is val3