Try OpenEdge Now
skip to main content
Application Migration and Development Guide
Application Development with PAS for OpenEdge : Programming the Progress Application Server for OpenEdge : Managing client context for session-free and unbound session-managed connections : Generating a client context identifier
 
Generating a client context identifier
The client context identifier is typically a globally unique character string. For performance, the maximum length of the string should be less than 36 characters. The client context identifier can also be a blank ("") value or the Unknown value (?).
The following code fragment shows a recommended ABL assignment statement for generating a unique value for the client context identifier:
DEFINE VARIABLE ccid AS CHARACTER NO-UNDO.
ccid = SUBSTRING(BASE64-ENCODE (GENERATE-UUID), 1, 22).
This is only one of the methods you can use to generate a client context identifier, but it does generate a globally unique value.
The default method of generating the client context identifier is to allow the clients (ABL, Java, and .NET) to automatically generate the value and send it to the server. Optionally, the client or the server session can create their own client context identifier for advanced application logic.
For example, the client context identifier in an ABL session needs to be reset in order to indicate the end of the client user login session. This is typically done when the server invalidates the current client login session by invoking the LOGOUT( ) method on the client-principal object that maintains the session, and by removing the client login context from the context store. The server then typically sets the ClientContextId property on the appropriate Progress.Lang.OERequestInfo class instance (available through the CURRENT-RESPONSE-INFO attribute on the SESSION handle) to the Unknown value (?). This tells the client that its current login session has been terminated, and any subsequent (presumably invalid) requests from the client on the same server connection will contain a client context identifier with the Unknown value (?). For more information on client-principal objects and using the ClientContextId property to manage context for user login sessions, see Implementing multi-tier security models in this manual and the sections on authenticating the user identity for multi-tier applications in OpenEdge Development: Programming Interfaces.