|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.joda.time.contrib.jsptag.Util
public class Util
Utilities in support of tag-handler classes.
Field Summary | |
---|---|
private static java.lang.String |
APPLICATION
|
(package private) static java.util.Locale[] |
availableFormattingLocales
Setup the available formatting locales that will be used by getFormattingLocale(PageContext). |
private static java.util.Locale |
EMPTY_LOCALE
|
private static char |
HYPHEN
|
private static java.lang.String |
REQUEST
|
(package private) static java.lang.String |
REQUEST_CHAR_SET
|
private static java.lang.String |
SESSION
|
private static char |
UNDERSCORE
|
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
private static java.util.Locale |
findFormattingMatch(java.util.Locale pref,
java.util.Locale[] avail)
Returns the best match between the given preferred locale and the given available locales. |
private static java.util.Locale |
findFormattingMatch(javax.servlet.jsp.PageContext pageContext,
java.util.Locale[] avail)
Determines the client's preferred locales from the request, and compares each of the locales (in order of preference) against the available locales in order to determine the best matching locale. |
private static javax.servlet.jsp.jstl.fmt.LocalizationContext |
findMatch(javax.servlet.jsp.PageContext pageContext,
java.lang.String basename)
Determines the client's preferred locales from the request, and compares each of the locales (in order of preference) against the available locales in order to determine the best matching locale. |
private static java.util.ResourceBundle |
findMatch(java.lang.String basename,
java.util.Locale pref)
Gets the resource bundle with the given base name and preferred locale. |
(package private) static java.util.Locale |
getFormattingLocale(javax.servlet.jsp.PageContext pc)
Returns the formatting locale to use when |
(package private) static java.util.Locale |
getFormattingLocale(javax.servlet.jsp.PageContext pc,
javax.servlet.jsp.tagext.Tag fromTag,
boolean format,
java.util.Locale[] avail)
Returns the formatting locale to use with the given formatting action in the given page. |
(package private) static java.util.Locale |
getLocale(javax.servlet.jsp.PageContext pageContext,
java.lang.String name)
Returns the locale specified by the named scoped attribute or context configuration parameter. |
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,
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. |
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. |
static int |
getScope(java.lang.String scope)
Converts the given string description of a scope to the corresponding PageContext constant. |
static java.util.Locale |
parseLocale(java.lang.String locale)
See parseLocale(String, String) for details. |
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)
Stores the given locale in the response object of the given page context, and stores the locale's associated charset in the javax.servlet.jsp.jstl.fmt.request.charset session attribute, which may be used by the |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String REQUEST
private static final java.lang.String SESSION
private static final java.lang.String APPLICATION
private static final char HYPHEN
private static final char UNDERSCORE
private static final java.util.Locale EMPTY_LOCALE
static final java.lang.String REQUEST_CHAR_SET
static java.util.Locale[] availableFormattingLocales
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static int getScope(java.lang.String scope)
scope
- String description of scope
public static java.util.Enumeration getRequestLocales(javax.servlet.http.HttpServletRequest request)
public static java.util.Locale parseLocale(java.lang.String locale)
public static java.util.Locale parseLocale(java.lang.String locale, java.lang.String variant)
locale
- the locale string to parsevariant
- the variant
java.lang.IllegalArgumentException
- if the given locale does not have a
language component or has an empty country componentstatic void setResponseLocale(javax.servlet.jsp.PageContext pc, java.util.Locale locale)
pc
- the page context whose response object is assigned the
given localelocale
- the response localestatic java.util.Locale getFormattingLocale(javax.servlet.jsp.PageContext pc, javax.servlet.jsp.tagext.Tag fromTag, boolean format, java.util.Locale[] avail)
pc
- The page context containing the formatting action @param
fromTag The formatting action @param format true if the
formatting action is of type avail
- the array of available locales
static java.util.Locale getFormattingLocale(javax.servlet.jsp.PageContext pc)
pc
- The page context containing the formatting action @return the
formatting locale to usestatic java.util.Locale getLocale(javax.servlet.jsp.PageContext pageContext, java.lang.String name)
The named scoped attribute is searched in the page, request, session (if valid), and application scope(s) (in this order). If no such attribute exists in any of the scopes, the locale is taken from the named context configuration parameter.
pageContext
- the page in which to search for the named scoped
attribute or context configuration parameter @param name the name of the
scoped attribute or context configuration parameter
private static java.util.Locale findFormattingMatch(javax.servlet.jsp.PageContext pageContext, java.util.Locale[] avail)
pageContext
- Page containing the formatting action @param avail
Available formatting locales
private static java.util.Locale findFormattingMatch(java.util.Locale pref, java.util.Locale[] avail)
pref
- the preferred locale @param avail the available formatting
locales
public 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, java.lang.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 name
private static javax.servlet.jsp.jstl.fmt.LocalizationContext findMatch(javax.servlet.jsp.PageContext pageContext, java.lang.String basename)
pageContext
- the page in which the resource bundle with the given
base name is requested @param basename the resource bundle's base name
private static java.util.ResourceBundle findMatch(java.lang.String basename, java.util.Locale pref)
basename
- the resource bundle base name @param pref the preferred
locale
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |