User Tools

Site Tools


Sidebar

Network and communication

k24:k24.6:k24.6.4:start

24.6.4 Class Request

You can use the class Request (gb.web) to write HTTP requests to an HTTP server. Examples for practical realisation can be found in Chapter24.6.8 Projects.

24.6.4.1 Properties

The Request class has these properties:

PropertyData typeDescription
CookiesCollectionGets an overview of all cookies contained in a HTTP request.
DebugBooleanReturns True if debug mode is on or sets debug mode. If debug mode is enabled, the contents of the post request are stored and can be read out via the property Request.Post.Contents.
DelimiterStringSets the character that delimits the fields in a GET or application/x-www-form-urlencoded-POST request or returns the delimiter character. The '&' character is the default delimiter.
FieldsString[ ]Stores a list of the names of all field variables contained in the request in a string array.
FilesCollectionGets a list of all files that are attached to the request. The keys of this collection are the file names specified in the request. The values of the collection are the path of the files stored on the server. All files are uploaded to the application's temporary directory. They are destroyed as soon as the application is terminated.
InternetExplorerIntegerReturns the version of Internet Explorer as HTTP client or NULL if Internet Explorer is not the HTTP client.
PathStringReturns the request path of the CGI application. Is the equivalent of CGI[“PATH_INFO”].
QueryStringReturns the query part of the request. Is the equivalent of CGI[“QUERY_STRING”].
MethodStringReturns the method “POST” or “GET” of the CGI application used to send queries (equivalent to CGI[“REQUEST_METHOD”]).
LanguageStringThe browser tells the server which language it is set to when a request is made. Use System.Language = Request.Language to internationalise the website.

Table 24.6.4.1.1 : Properties of the Request class

The Request.Get property returns a virtual object '_Request_Get' to retrieve the data stored in the GET request, while the Request.Post property returns a virtual object '_Request_Post' to retrieve the data stored in the POST request.

PropertyData typeDescription
_Get.FieldsString[ ]Returns a data array containing all the fields contained in the GET request URL.
_Post.ContentsStringReturns the request contents if the property 'Request.Debug' is set to the value True.
_Post.FieldsString[ ]Returns a data array with all fields in the POST request content.
_Post.FilesCollectionReturns a collection of the files sent with the POST request. The key contains the file name and the file path is stored as a corresponding value in this collection.

Table 24.6.4.1.2 : Properties of the _Request_Get and _Request_Post virtual classes.

Notes:

  • Each file is stored in a temporary file on disk.
  • If the /tmp directory has limited capacity, there could be problems with files that are too large.

24.6.4.2 Methods

The Request (gb.web) class has only one method:

Static Function Exist ( Field As String ) As Boolean

The function returns True if the specified field exists in the HTTP request - regardless of the GET or POST method used.

Also, the two virtual classes _Request_Get and _Request_Post each have a method:

Function _Request_Get.Exist ( Field As String ) As Boolean
Function _Request_Post.Exist ( Field As String ) As Boolean

Both functions return True as the function value respectively if the specified field exists in the GET or POST request.

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k24/k24.6/k24.6.4/start.txt · Last modified: 15.10.2022 (external edit)

Page Tools