$webinfo ("WebServerContext")

The WebServerContext topic contains an associative list of properties that provide state information about the Uniface Server and the context in which it is running.

$webinfo("WebServerContext"), PropertiesList

Parameters

Parameters

Parameter

Data Type

Description

PropertiesList

String

Associative list of the following properties:

  • OPERATION—name of the operation to be executed in the component
  • COMP—name of the component to be executed
  • SESSION—unique session identifier
  • AUTHORIZATION—key that is the result of authorization
  • SESSIONCOOKIE—indicates whether cookies are used for state management: true, false, or dynamic.
  • SERVERVARIABLES—all web server variables that are supported by the WRD. See Server Variables Supported by the WRD.
  • SESSIONATTRIBUTES—a Uniface list of session attributes that have been set with the SetAttributes API. See Getting Session Attributes.

For more information, see Using Default Temporary Tables to Maintain State .

Note:The following properties are deprecated and should not be used. They do not provide the proper information for contained DSP instances. Use $webrequesttype and $webresponsetype instead.

  • REQUESTTYPE—type of request from the browser for the component instance; one of static or dynamic.Use $webrequesttype.
  • EXPECTEDRESPONSE—response expected by the browser for the component instance.; one of fullpage or update. Use$webresponsetype.

Description

Server variables are in a nested list. To retrieve a server variable, you can use $webinfo("WebServerContext") and SERVERVARIABLES as the id to obtain the list of server variables, and then use getitem/id to extract the desired server variable from the list.

Example: Inspecting Server Variables

For example, to obtain the SERVER_PROTOCOL variable:

variables
   string vServerVars, vServerProtocol
endvariables

getitem/id vServerVars, $webinfo("WEBSERVERCONTEXT"), "SERVERVARIABLES"
getitem/id vServerProtocol, vServerVars, "SERVER_PROTOCOL"

message/info "The server protocol is %%server_protocol%%%."

Server Variables Supported by the WRD

Not all server variables are supported by all servers. For more information about the server variables supported by your web server, consult the documentation for your web server.

Server Variables Supported by the WRD
Server Variable Description
AUTH_TYPE The authentication method used by the server (such as Basic or NTLM). Empty when no authentication method is used
CONTENT_LENGTH The length of data
CONTENT_TYPE MIME type of message content

Mime types starting with 'text/' or the prefix 'text:' will be seen as textual output and so converted to a string. All others will be considered to be raw data. The 'text:' prefix will be stripped from the Mime type by the WRD, so it will not be part of the text sent to the web browser.

PATH_INFO Last part of the URI, without the server and protocol
PATH_TRANSLATED Physical path of PATH_INFO on server
QUERY_STRING Query part of the URI; the client's query string
REMOTE_ADDR IP address of the client sending the request
REMOTE_HOST Fully qualified domain name of the client sending the request
REMOTE_USER The user ID sent by the client issuing the request
REQUEST_METHOD Method in which the request was made, such as GET, POST, PUT, DELETE, or HEAD
REQUEST_URI Returns the part of the URL after the host identifier, including the servlet engine application name, servlet mapping name (default), and anything thereafter (not including the query string).
SERVLET_PATH Returns the servlet instance requested. Note that this can be different from the string in the URL because the servlet mapping can map a URL string to a servlet with a different name.
SERVER_NAME The host identifier of the web server machine.
SERVER_PROTOCOL Name and revision number of the information protocol of the incoming request.
SERVER_PORT The port of the web server.
SERVER_PORT_SECURE Indicates whether the request is being handled on a secure port (that is, connected by HTTPS connection) or not. 1 indicates a secure port; otherwise, the value is 0

Getting Session Attributes

You can examine HTTP session attributes maintained by the WRD in the J2EE web container. These attributes can be using the SetAttributes property of $webinfo ("SESSIONCOMMANDS"). For more information, see $webinfo ("SessionCommands") and SetAttributes.

variables 
  string sessionAttrList, value
endvariables

; Load the Uniface list of session attributesthe by getting the value 
; of the property "SESSIONATTRIBUTES" of WEBINFO topic "WEBSERVERCONTEXT"
getitem/id sessionAttrList, $webinfo("WEBSERVERCONTEXT"), "SESSIONATTRIBUTES"

; Load the value of the session attributes "MyData" into the variable "value"
getitem/id value, sessionAttrList, "MyData"
History

Version

Change

9.5.01

Added SESSIONATTRIBUTES property