Required for setting the security token that will be used for all connections in the current thread or process.
A call to either SetThreadSecurityToken
or SetProcessSecurityToken
is required to communicate with the Content Engine server. When a SecurityToken
is specified, a request to the server is limited, through authorization access control, to the operations that have been granted to the specified principal. Correspondingly, if a locale is specified, the server attempts to return localizable messages, such as exception text, according to the language code specified by the locale.
As noted above, UserContext
operations are performed on a per-thread or per-process basis. When working with multiple locales, for example when servicing requests via a thread pool, you must explicitly call SetLocale at the beginning of each new thread (request). The following code snippet illustrates the call to make at the startup phase of every request, where reqLocale
is the locale (System.Globalization.CultureInfo
) to be used for this request:
| Copy Code
|
---|
UserContext uc = UserContext.Get();
uc.SetLocale(reqLocale);
|
Namespace: FileNet.Api.UtilAssembly: FileNet.Api (in filenet.api.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Class UserContext |
C# |
---|
public class UserContext |
J# |
---|
public class UserContext |
JScript |
---|
public class UserContext |
Inheritance Hierarchy
Thread Safety
Public static (Shared in Visual Basic)staticShared members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
See Also