+

Search Tips   |   Advanced Search

 

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:

As a convenience, you can create named container internationalization attributes and associate them to the following subsets:

 

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). You 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. 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.

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]. You 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:

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.


 

Related concepts


Internationalization type
Internationalization context: Management policies

 

Related tasks


Setting the internationalization type for servlets
Setting the internationalization type for enterprise beans