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.
- Run as
- Locales
- Time zone ID
- CMI servlets within a Web module
- Business methods of CMI enterprise beans within an Enterprise JavaBeans (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).
- 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 Java™ virtual machine (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 that is specified in the policy; then provide the custom context elements by completing the Locales and Time zone ID fields.
Locales field
- 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. You 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.