Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop Internationalization service > Task overview: Internationalizing application components (internationalization service) > Use the internationalization context API > Internationalization context: Management policies
Container internationalization attributes
The internationalization policy of every CMI servlet and EJB business method has a container internationalization attribute that specifies which internationalization context the container is to scope to its invocation.
The container internationalization attribute has three main fields:
- Run as
- Locales
- Time zone ID
As a convenience, you can create named container internationalization attributes and associate them to the following subsets:
- CMI servlets within a Web module
- Business methods of CMI enterprise beans within an EJB module
- Business methods of Web service-enabled session beans. In the following descriptions, the term supported enterprise bean refers to both CMI enterprise beans and Web service-enabled session beans.
Run-as field
The Run-as field specifies one of three types of invocation context that a container can scope to a method. For servlet service and EJB business methods, the container constructs the invocation internationalization context according to the Run as field setting and associates this context to the current thread before delegating to the method implementation.
By default, invocations of servlet service methods and EJB business methods implicitly run as caller (RunAsCaller) unless the Run as field of a policy attribute specifies otherwise. EJB client applications and AMI server components always run as server (RunAsServer).
We can specify the following invocation context types with the Run as field are:
Caller
The container calls the method under the internationalization context of the calling process. For any missing context element, the container supplies the corresponding default context element of the JVM (JVM). Select run as caller when you want the invocation to run under the invocation context of the calling process.
Server
The container calls the method under the default locale and time zone of the JVM. Select run as server when you want the invocation to run under the invocation context of the JVM.
Specified
The container calls the method under the internationalization context specified in the attribute. Select run as specified when you want the invocation to run under the custom invocation context specified in the policy; then provide the custom context elements by completing the Locales and Time zone ID fields. Remember: JMS messages do not contain internationalization context. Although container-managed message-driven beans can be configured to run as caller, the container associates the default elements of the server process when calling the onMessage method of any message-driven bean that is configured as [CMI, RunAsCaller]. We can also configure the Run as field for Web service business methods.
Locales field
The Locales field specifies an ordered list of locales that the container scopes to an invocation. A locale represents a specific geographical, cultural, or political region and contains three fields:
- Language code. Ideally, language code is one of the lower-case, two-character codes that are defined by the ISO 639 standard; however, language code is not restricted to ISO codes and is not a required field. A valid locale must specify a language code if it does not specify a country code.
- Country code. Ideally, country code is one of the upper-case, two-character codes that are defined by the ISO 3166 standard; however, country code is not restricted to ISO codes and is not a required field. A valid locale must specify a country code if it does not specify a language code.
- Variant. Variant is a vendor-specific code. Variant is not a required field and serves only to supplement the language and country code fields according to application- or platform-specific requirements.
A valid locale must specify at least a language code or a country code; the variant is always optional. The first locale of the list is returned when accessing invocation context using the getLocale method of the internationalization context API.
Time zone ID field
The Time zone ID field specifies an abbreviated identifier for a time zone that the container scopes to an invocation. We can also configure the Time zone ID field for Web service business methods.
A time zone represents a temporal offset and computes daylight savings information. A valid ID indicates any time zone supported by the java.util.TimeZone type. Specifically, a valid ID is any of the IDs that appear in the list of time zone IDs returned by method java.util.TimeZone.getAvailableIds(), or a custom ID having the form GMT[+|-]hh[[:]mm]; for example, America/Los_Angeles, GMT-08:00 are valid time zone IDs.
Internationalization type
Internationalization context: Management policies
Set the internationalization type for servlets
Set the internationalization type for enterprise beans