public class Util extends Object
Utilities in support of tag-handler classes.
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static javax.servlet.jsp.jstl.fmt.LocalizationContext |
getLocalizationContext(javax.servlet.jsp.PageContext pc)
Gets the default I18N localization context.
|
static javax.servlet.jsp.jstl.fmt.LocalizationContext |
getLocalizationContext(javax.servlet.jsp.PageContext pc,
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.
|
static Enumeration |
getRequestLocales(javax.servlet.http.HttpServletRequest request)
HttpServletRequest.getLocales() returns the server's default locale if
the request did not specify a preferred language.
|
static int |
getScope(String scope)
Converts the given string description of a scope to the corresponding
PageContext constant.
|
static Locale |
parseLocale(String locale)
See parseLocale(String, String) for details.
|
static Locale |
parseLocale(String locale,
String variant)
Parses the given locale string into its language and (optionally) country
components, and returns the corresponding java.util.Locale
object.
|
public static int getScope(String scope)
scope
- String description of scopepublic static Enumeration getRequestLocales(javax.servlet.http.HttpServletRequest request)
public static Locale parseLocale(String locale)
public static Locale parseLocale(String locale, String variant)
locale
- the locale string to parsevariant
- the variantIllegalArgumentException
- if the given locale does not have a
language component or has an empty country componentpublic static javax.servlet.jsp.jstl.fmt.LocalizationContext getLocalizationContext(javax.servlet.jsp.PageContext pc)
pc
- Page in which to look up the default I18N localization contextpublic static javax.servlet.jsp.jstl.fmt.LocalizationContext getLocalizationContext(javax.servlet.jsp.PageContext pc, String basename)
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.
pc
- Page in which the resource bundle with the given base
name is requestedbasename
- Resource bundle base nameCopyright © 2005–2014 Joda.org. All rights reserved.