$webinfo ("RequestContext")
Get or set request context attributes.
$webinfo("RequestContext") {=
AtrributeList}
Parameters
Parameter | Data Type | Description |
---|---|---|
AtrributeList | String | Uniface list of name-value attributes containing state information that is required for the current HTTP request. |
Description
The
$webinfo("RequestContext")
topic
contains a Uniface list of name-value attributes that can be shared between various operations,
triggers, and DSPs that are activated in the course of the processing HTTP request.
When a new HTTP request is received from the client browser, the Uniface Server creates an empty request context for the DSP. The DSP can set and get request context attributes using $webinfo("RequestContext").
Using the WrdActivate session management API, you can instruct the WRD to activate a callback operation on another component instance. The callback request is typically used to send the new and old session ID to the Uniface Server from the WRD. It can be called several times while the HTTP request is processed, and during that time, the request context is used to share the information between the current request and possible callback requests. In this way, if a security component is called to change the session ID, the new session ID is obtained by the Uniface Server so that it can contain the correct information when it sends the response back to the client browser.
As long as a DSP response contains a WrdActivate call, no response is sent back to the browser. The Uniface Server only sends the result of the last response (without WrdActivate) back to the web client as the HTTP response. It then destroys the request context and all attributes are lost.
Applications can also use the request context to share the data between different operations, triggers, and to share data between different components.
Using $webinfo("RequestContext")
The following example shows how you can get and
set request context state information using the
$webinfo("RequestContext")
function.
variables
string requestAttrList, value
endvariables
requestAttrList = "USERNAME=John;ROLE=Admin"
; Assign a list to the request context
$webinfo("RequestContext") = requestAttrList
; get the value of attributes "USERNAME" and put it into variable "value"
; of the property "SessionAttributes" of WEBINFO topic "WebServerContext"
getitem/id value, $webinfo("RequestContext"), "USERNAME"
; Set the value of the attribute "ROLE" to "Guest"
putitem/id $webinfo("RequestContext"), "ROLE", "Guest"
; Add a new attribute "Message” with value "Hello!"
putitem/id $webinfo("RequestContext"), "Message", "Hello!"
; delete the attribute "Message"
delitem/id $webinfo("RequestContext"), "Message"
Version |
Change |
---|---|
9.5.01 |
Introduced
|