![]() |
The Internationalization Service transparently propagates locales and time zone across the various components of an Enterprise JavaBean application, including (contained) Java clients, Enterprise JavaBeans and servlets. How the service propagates Internationalization context is determined by its context management policies.
For this release, the following context management policies correspond to whether an application component is contained on the client-side or on the server-side:
- Client-side Internationalization
- Enterprise JavaBean client application components deployed within J2EE client containers, only, are subject to the Client-side Internationalization (CSI) policy.
In CSI, client applications can programmatically get and set the invocation context elements (that is, locales and time zone) associated with the current thread by using the Internationalization context API. Invocation context elements set using the API persist until set again or until the application exits. Clients may also get the caller context elements associated with the current thread. In a client application, caller context is always the default locale and time zone of the process.
On remote bean method calls originating from a client application, the service propagates all invocation context elements associated to the current thread with the outgoing request. If an invocation context element is non-null (that is, it was set using the API) the service propagates the specified element; otherwise, the service propagates the default element that is associated with the process at that time.
- Server-side Internationalization
- Enterprise JavaBean application components deployed within J2EE server-side containers are subject to the Server-side Internationalization (SSI) policy. SSI is a simple, immutable policy that uniformly specifies how Internationalization context propagates across the Web and Enterprise JavaBean container boundaries and defines access privileges to Internationalization context within contained application components.
In SSI, server-side application components always run under the caller’s Internationalization context. More specifically, the service associates the context of an incoming business method request to the thread on which that method will execute. The incoming (or caller) context is associated as both the caller and invocation context for that method and persists until the method returns.
This policy is applied directly to Enterprise JavaBean methods: On incoming remote bean method requests, the service associates the caller’s context to the thread on which the request will execute. SSI is defined slightly differently with respect to servlet service methods (for example, doGet() or doPost()) because they are invoked using HTML browser clients: On incoming servlet service requests originating from an HTML browser client, the service associates the list of locales, propagated by the browser within the HTTP header, and the server’s default time zone to the thread on which the servlet service method will execute.
For remote bean method calls originating from either a servlet or Enterprise JavaBean method, the service propagates all invocation context elements associated to the current thread on the outgoing request. If an invocation context element is non-null (that is, it was set using the API) the service propagates the specified element; otherwise, the service propagates the default element associated with the server process at that time. This is identical to CSI, except that in SSI, invocation context is always that of the caller. This management policy could be referred to as "RunAsCaller/DefaultToServer".
Enterprise JavaBeans implementations and Servlets can use the Internationalization service API to programmatically get both caller and invocation context elements (that is, locales and time zone) associated with the current thread, but cannot set them. This restriction enforces the "RunAsCaller/DefaultToServer" context management strategy and ensures that the invocation context of every client application request, including those from HTTP browsers, distributes over the span of that request.
Related reference... | |
Internationalization context | |
Thread association considerations | |
The JNDI environment | |
Internationalization context application programming interface | |
Handling exceptions | |
View PDF file... | |
To view a PDF file containing this article and related articles, click: | |
![]() | |