Try OpenEdge Now
skip to main content
Developing AppServer Applications
Programming ABL Client Applications : Accessing client context regardless of session model
 

Accessing client context regardless of session model

OpenEdge supports the ClientContextId property on the Progress.Lang.OERequestInfo class that you can use to identify client context for both session-free and session-managed applications, especially in multi-tier application environments. OpenEdge provides instances of this class that you can reference using attributes of both the ABL client's server object handle and the AppServer agent's SESSION system handle.
OpenEdge creates one instance of OERequestInfo when the client creates a server object handle and assigns the REQUEST-INFO attribute to the object reference. OpenEdge also initializes the ClientContextId property on this instance with a globally unique value that the client application can change, if necessary, before each remote request using the same server handle.
When the client makes a remote request on this server handle, the values of this property and other properties of OERequestInfo are sent to the AppServer agent, where they initialize the same properties in a separate instance of OERequestInfo that is referenced by the CURRENT-REQUEST-INFO attribute on the agent's SESSION handle. When the agent completes its handling of the request, it returns the OERequestInfo property values to the client that are set in the instance referenced by the CURRENT-RESPONSE-INFO attribute. Some of these values are different from those available through the CURRENT-REQUEST-INFO attribute, but the ClientContextId property value is the same unless your agent code changes it prior to returning to the client.
When the remote request returns a response to the client, the client code can read the property values returned from the AppServer in an OERequestInfo instance referenced by the RESPONSE-INFO attribute on the server object handle (or on the asynchronous request object handle returned for an asynchronous request).
For each subsequent client request on the same server handle, OpenEdge initializes the ClientContextId property on the REQUEST-INFO attribute instance from the ClientContextId value on the RESPONSE-INFO attribute, unless the client application changes the value prior to the request. In this way, a ClientContextId value can be propagated between the same client and AppServer with little or no code intervention.
Typically you use the client context identifier value set for the ClientContextId property to key a context store that is initialized at the start of a user login session and shared between the client and all AppServers that participate in the same login session. For more information on using the ClientContextId and other properties of the Progress.Lang.OERequestInfo class, especially on the AppServer, see Managing state-free and stateless client context. The following section describes use of these properties on the ABL client.
* Managing context from the ABL client with OERequestInfo objects