Package javax.servlet.jsp.jstl.fmt
Class JakartaInline
- java.lang.Object
-
- javax.servlet.jsp.jstl.fmt.JakartaInline
-
class JakartaInline extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Locale
EMPTY_LOCALE
private static char
HYPHEN
(package private) static java.lang.String
REQUEST_CHAR_SET
(package private) static java.lang.String
UNDEFINED_KEY
private static char
UNDERSCORE
-
Constructor Summary
Constructors Constructor Description JakartaInline()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.util.ResourceBundle
findMatch(java.lang.String basename, java.util.Locale pref)
private static LocalizationContext
findMatch(javax.servlet.jsp.PageContext pageContext, java.lang.String basename)
private static java.lang.ClassLoader
getClassLoaderCheckingPrivilege()
(package private) static java.util.Locale
getLocale(javax.servlet.jsp.PageContext pageContext, java.lang.String name)
(package private) static LocalizationContext
getLocalizationContext(javax.servlet.jsp.PageContext pc)
Gets the default I18N localization context.(package private) static LocalizationContext
getLocalizationContext(javax.servlet.jsp.PageContext pc, java.lang.String basename)
Gets the resource bundle with the given base name, whose locale is determined as follows:static java.util.Enumeration
getRequestLocales(javax.servlet.http.HttpServletRequest request)
HttpServletRequest.getLocales() returns the server's default locale if the request did not specify a preferred language.private static java.util.Locale
parseLocale(java.lang.String locale, java.lang.String variant)
Parses the given locale string into its language and (optionally) country components, and returns the corresponding java.util.Locale object.(package private) static void
setResponseLocale(javax.servlet.jsp.PageContext pc, java.util.Locale locale)
-
-
-
Field Detail
-
UNDEFINED_KEY
static final java.lang.String UNDEFINED_KEY
- See Also:
- Constant Field Values
-
EMPTY_LOCALE
private static final java.util.Locale EMPTY_LOCALE
-
HYPHEN
private static final char HYPHEN
- See Also:
- Constant Field Values
-
UNDERSCORE
private static final char UNDERSCORE
- See Also:
- Constant Field Values
-
REQUEST_CHAR_SET
static final java.lang.String REQUEST_CHAR_SET
- See Also:
- Constant Field Values
-
-
Method Detail
-
getLocalizationContext
static LocalizationContext getLocalizationContext(javax.servlet.jsp.PageContext pc)
Gets the default I18N localization context.- Parameters:
pc
- Page in which to look up the default I18N localization context
-
getLocalizationContext
static LocalizationContext getLocalizationContext(javax.servlet.jsp.PageContext pc, java.lang.String basename)
Gets the resource bundle with the given base name, whose locale is determined as follows:Check if a match exists between the ordered set of preferred locales and the available locales, for the given base name. The set of preferred locales consists of a single locale (if the javax.servlet.jsp.jstl.fmt.locale configuration setting is present) or is equal to the client's preferred locales determined from the client's browser settings.
If no match was found in the previous step, check if a match exists between the fallback locale (given by the javax.servlet.jsp.jstl.fmt.fallbackLocale configuration setting) and the available locales, for the given base name.
- Parameters:
pageContext
- Page in which the resource bundle with the given base name is requestedbasename
- Resource bundle base name- Returns:
- Localization context containing the resource bundle with the given base name and the locale that led to the resource bundle match, or the empty localization context if no resource bundle match was found
-
findMatch
private static LocalizationContext findMatch(javax.servlet.jsp.PageContext pageContext, java.lang.String basename)
-
findMatch
private static java.util.ResourceBundle findMatch(java.lang.String basename, java.util.Locale pref)
-
getClassLoaderCheckingPrivilege
private static java.lang.ClassLoader getClassLoaderCheckingPrivilege()
-
getRequestLocales
public static java.util.Enumeration getRequestLocales(javax.servlet.http.HttpServletRequest request)
HttpServletRequest.getLocales() returns the server's default locale if the request did not specify a preferred language. We do not want this behavior, because it prevents us from using the fallback locale. We therefore need to return an empty Enumeration if no preferred locale has been specified. This way, the logic for the fallback locale will be able to kick in.
-
setResponseLocale
static void setResponseLocale(javax.servlet.jsp.PageContext pc, java.util.Locale locale)
-
getLocale
static java.util.Locale getLocale(javax.servlet.jsp.PageContext pageContext, java.lang.String name)
-
parseLocale
private static java.util.Locale parseLocale(java.lang.String locale, java.lang.String variant)
Parses the given locale string into its language and (optionally) country components, and returns the corresponding java.util.Locale object.If the given locale string is null or empty, the runtime's default locale is returned.
- Parameters:
locale
- the locale string to parsevariant
- the variant- Returns:
- java.util.Locale object corresponding to the given locale string, or the runtime's default locale if the locale string is null or empty
- Throws:
java.lang.IllegalArgumentException
- if the given locale does not have a language component or has an empty country component
-
-