|
Oracle® Database Globalization Development Kit Java API Reference 10g Release 2 (10.2) Part No. B14224-02 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--oracle.i18n.servlet.ApplicationContext
The ApplicationContext class provides an application with a
globalization configuration environment and controls application scope
operations in the GDK framework.
Generally in a J2EE based application, the application code does not need to
explicitly create an ApplicationContext object, but rather
retrieves an instance by calling the
ServletHelper.getApplicationContextInstance(HttpServletRequest)
method. In JSP/Servlet based applications, the ApplicationContext is driven
by the GDK Application Configuration file gdkapp.xml. The elements
of the configuration file, for example: application-locales,
page-charset, locale-charset-maps, etc... map to
methods in this class. To better understand the various configuration
elements, see the The GDK Application Configuration File section of
the Globalization Development Guidelines document.
An instance of this object must be created at startup time of the
application either by the ContextListener object or in a custom
context listener for Java/JSP server applications and be registered in
the servlet context with the key ApplicationContext.OBJECT.
| Field Summary | |
static String |
DEFAULT_GDKAPP
The Constant for the name of the default GDK application configuration file. |
static String |
OBJECT_KEY
Constant for the key name used to retrieve the ApplicationContext object. |
| Constructor Summary | |
ApplicationContext(InputStream pathToConfigFile)
Constructs an ApplicationContext object based on the specified application configuration InputStream. |
|
ApplicationContext(InputStream pathToConfigFile,
ClassLoader cloader)
Constructs an ApplicationContext object based on the specified application configuration InputStream and the ClassLoader object.
|
|
ApplicationContext(String pathToConfigFile)
Constructs an ApplicationContext object that is based on a specified GDK application configuration file. |
|
ApplicationContext(String pathToConfigFile,
ClassLoader cloader)
Constructs an ApplicationContext object that is based on a specified GDK application configuration file and the ClassLoader object. |
|
| Method Summary | |
Locale |
fallbackLocale(Locale locale)
Validates if the locale supplied as an argument is supported. |
oracle.i18n.servlet.localesource.LocaleSource |
getApplicationDefaultLocaleSource()
Returns the application default locale source instance. |
String |
getIANAPageCharacterSet()
Returns the default IANA page character set name of the application or returns the string AUTO-CHARSET.
|
Class[] |
getLocaleSources()
Returns an array of locale source Class objects that are used to determine the current locale. |
Map |
getMessageBundle()
Returns a Map consisting of message bundle name and
message bundle object pairs. |
String |
getParameterName(LocaleSource.Parameter parameter)
Returns a String representing the parameter name used to
specify locale attributes. |
String[] |
getSupportedIANACharacterSets()
Returns an array of supported IANA character set names. |
Locale[] |
getSupportedLocales()
Returns an array of locales supported by the application. |
String[] |
getSupportedOraLanguages()
Returns supported Oracle languages based on the application locale list. |
String[] |
getSupportedOraLanguages(String oraTerritory)
Returns supported Oracle languages for the Oracle territory. |
String[] |
getSupportedOraTerritories()
Returns the supported Oracle territories. |
String[] |
getSupportedOraTerritories(String oraLanguage)
Returns supported Oracle territories for the Oracle language. |
int |
hashCode()
Returns the hash value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String OBJECT_KEY
public static final String DEFAULT_GDKAPP
| Constructor Detail |
public ApplicationContext(String pathToConfigFile)
throws ClassNotFoundException,
PatternSyntaxException,
UnsupportedEncodingException
ClassLoader object is derived from this object.
Note: Do not use this method for a JSP/Java Servlet application, instead,
use the
ServletHelper.getApplicationContextInstance(HttpServletRequest)
method.
pathToConfigFile - an absolute file path of the application
configuration file
ClassNotFoundException - if the LocaleSource class
is not found
PatternSyntaxException - if rewriting rule or locale to charset mapping
regular expression is invalid
UnsupportedEncodingException - if character set is invalid
public ApplicationContext(InputStream pathToConfigFile)
throws ClassNotFoundException,
PatternSyntaxException,
UnsupportedEncodingException
pathToConfigFile - an input stream object that references the
application configuration file
ClassNotFoundException - if the LocaleSource class
is not found
PatternSyntaxException - if rewriting rule or locale to charset mapping
regular expression is invalid
UnsupportedEncodingException - if character set is invalid
public ApplicationContext(String pathToConfigFile,
ClassLoader cloader)
throws ClassNotFoundException,
PatternSyntaxException,
UnsupportedEncodingException
ClassLoader object. The class loader may be required
when a custom LocaleSource object is used in the application
configuration file.
Note: Do not use this method for a JSP/Java Servlet application, instead,
use the
ServletHelper.getApplicationContextInstance(HttpServletRequest)
method.
pathToConfigFile - an absolute file path of the application
configuration filecloader - the ClassLoader object that will be used
to load LocaleSource classes and message bundles.
ClassNotFoundException - if the LocaleSource class
is not found
PatternSyntaxException - if rewriting rule or locale to charset mapping
regular expression is invalid
UnsupportedEncodingException - if character set is invalid
public ApplicationContext(InputStream pathToConfigFile,
ClassLoader cloader)
throws ClassNotFoundException,
PatternSyntaxException,
UnsupportedEncodingException
ClassLoader object.
The class loader is required if you will be using a custom
LocaleSource object that is specified in the GDK
application configuration file.
pathToConfigFile - an input stream object that references the
application configuration filecloader - the ClassLoader object that will be used
to load LocaleSource classes and message bundles.
ClassNotFoundException - if the LocaleSource class
is not found
PatternSyntaxException - if rewriting rule or locale to charset mapping
regular expression is invalid
UnsupportedEncodingException - if character set is invalid| Method Detail |
public String getIANAPageCharacterSet()
AUTO-CHARSET.
If the value AUTO-CHARSET is set, this implies that the
GDK framework automatically assigns an appropriate character set value
based on the locale.
If the AUTO-CHARSET value is set, you may retrieve the
resolved character set name by using the
Localizer.getIANACharacterSet() method.
AUTO-CHARSETpublic String getParameterName(LocaleSource.Parameter parameter)
String representing the parameter name used to
specify locale attributes. For example, if you want to get the locale
value, use the LocaleSource.Parameter.LOCALE object as input.
For example:
ApplicationContext appctx = ServletHelper.getApplicationContextInstance( request); String locale = request.getParameter( appctx.getParameterName(LocaleSource.Parameter.LOCALE));
parameter - a parameter type
public Class[] getLocaleSources()
LocaleSource Class objectspublic oracle.i18n.servlet.localesource.LocaleSource getApplicationDefaultLocaleSource()
LocaleSource representing the application default
localepublic Map getMessageBundle()
Map consisting of message bundle name and
message bundle object pairs.
ResourceBundle objectpublic Locale[] getSupportedLocales()
The supported locale can be specified in the application configuration file.
Locale objects representing supported
locales in the applicationpublic String[] getSupportedOraLanguages(String oraTerritory)
The supported languages are determined by the supported locale. If the
given territory name is null, all supported Oracle
languages are returned.
oraTerritory - Oracle territory name. If this parameter is null,
then the method will return all supported Oracle languages that
are based on the application locale list.
String representing the supported
languages in the applicationpublic String[] getSupportedOraLanguages()
The supported languages are determined by the supported locale.
String objects representing the supported
languages in the applicationpublic String[] getSupportedOraTerritories(String oraLanguage)
The supported territories are determined by the supported locale list. If the
given language is null, all available territories are
returned.
oraLanguage - Oracle language name
String representing the supported
territories in the applicationpublic String[] getSupportedOraTerritories()
The supported territories are determined by the supported locale list.
String representing the supported
territories in the applicationpublic String[] getSupportedIANACharacterSets()
public Locale fallbackLocale(Locale locale)
If you are not sure that the given locale is supported, call this method the custom locale source object.
Note that supported locales in the application are not equivalent to the
translation locales that are handled by the ResourceBundle class or the ServletHelper.rewriteURL(String,
HttpServletRequest) method. They validate locales by checking the actual
translation resources. If the given locale's translation exists, it is
returned, otherwise, it returns the fallback locale's translation.
locale - a Locale object to be examined
Locale that is supported by the applicationpublic int hashCode()
hashCode in class Object
|
Oracle® Database Globalization Development Kit Java API Reference 10g Release 2 (10.2) Part No. B14224-02 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||