com.ibm.portal.services.globalization.preferences
Interface GlobalizationPreferencesService


public interface GlobalizationPreferencesService

Portal service to retrieve the globalization preferences. This service takes a Portal User object and reads each user's custom preferences and instantiates a com.ibm.icux.util.GlobalizationPreferences instance. The implementation caches default GlobalizationPreferences for each locale. GlobalizationPreferences can be read-only after configuration is set. Multiple users can share a single instance of the GlobalizationPreferences object.

Use the WebSphere Portal JNDI portlet service lookup mechanism to locate the GlobalizationPreferencesService implementation.

Usage Example:

 
 javax.naming.Context ctx = new javax.naming.InitialContext();
 GlobalalizationPreferencesService service = null;
 
 try {
     service = (GlobalizationPreferencesService) ctx.lookup(GlobalizationPreferencesService.JNDI_NAME);
 } catch(javax.naming.NameNotFoundException ex) {
     ... error handling ...
 }
 ...
 if (service != null) {
    GlobalizationPreferences preferences = service.getGlobalizationPreferences(user, acceptLanguageHeader);
     ...
 }
 
 

Since:
6.1

Field Summary
static java.lang.String JNDI_NAME
          The JNDI name that can be used to lookup instances of this service
 
Method Summary
 com.ibm.icux.util.GlobalizationPreferences getGlobalizationPreferences(com.ibm.portal.puma.User user, java.lang.String acceptLanguageHeader)
          Retrieves the user's GlobalizationPreferences object if user is defined and not null, otherwise tries to create a new set of preferences based on the accept-language header if defined and not null.
 

Field Detail

JNDI_NAME

static final java.lang.String JNDI_NAME
The JNDI name that can be used to lookup instances of this service

See Also:
Constant Field Values
Method Detail

getGlobalizationPreferences

com.ibm.icux.util.GlobalizationPreferences getGlobalizationPreferences(com.ibm.portal.puma.User user,
                                                                       java.lang.String acceptLanguageHeader)
Retrieves the user's GlobalizationPreferences object if user is defined and not null, otherwise tries to create a new set of preferences based on the accept-language header if defined and not null. If no parameters are defined then the service will use the configured default locale and create a new set of preferences.

Parameters:
user - The user in which the GlobalizationPreferences object will be retrieved, allowed to be null.
acceptLang - The accept-language header from the browser settings, allowed to be null.
Returns:
the GlobalizationPreferences object which contains bundled localization information specific to a user or locale.