Try OpenEdge Now
skip to main content
Developing AppServer Applications
Programming the AppServer : Managing state-free and stateless client context : 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 AppServer clients (ABL, Java, and .NET) to automatically generate the value and send it to the AppServer. Optionally, the AppServer client or the AppServer agent 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 to the same AppServer 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.