getServerVariable(var: String): String;
The getServerVariable method of the JadeRestService class returns the specified HTTP header information for your REST service request from the Internet Information Server (IIS). This method must be called during the processing of a REST service message; for example, from a re‑implementation of the JadeRestService class processRequest method. Calling the method when a message is not being processed results in null always being returned.
As the var parameter is IIS‑dependent, it is therefore subject to change. Refer to the ServerVariables function in your Internet Information Services (IIS) documentation for details.
The method in the following example returns the IP address of the REST service as determined by IIS.
processRequest(httpIn: String; queryStr: String; pathIn: String; methodType: String) updating; vars str : String; begin str := self.getServerVariable("ALL_HTTP"); inheritMethod(httpIn, queryStr, pathIn, methodType); end;
Common server environment variables, documented in the IIS documentation under the ServerVariables function, include those listed in the following table.
Variable | Returns… |
---|---|
HTTP_ACCEPT_LANGUAGE | A string describing the language to use for displaying content |
HTTP_USER_AGENT | A string describing the browser that sent the request |
HTTPS | ON if the request came in through a secure channel (SSL) or it returns OFF if the request is for a non‑secure channel |
REMOTE_ADDR | IP address of the remote host making the request |
SERVER_NAME | Host name, DNS alias, or IP address of the server as it would appear in self‑referencing URLs |
SERVER_PORT | Port number to which the request was sent |
URL | Base portion of the URL |
The method must be called on the same node as the application. If you call the method from a server method and the application is not running on the server, a 31039 error (Connection invalid invocation) occurs when trying to access the TCP/IP connection, and error 1242 (A method executing in another node was aborted) is reported to the REST service.