@Override public void release() { super.release(); valueExpression = null; variantExpression = null; }
static Locale getFormattingLocale(PageContext pc) { /* * Establish formatting locale by comparing the preferred locales * (in order of preference) against the available formatting * locales, and determining the best matching locale. */ Locale match = null; Locale pref = getLocale(pc, Config.FMT_LOCALE); if (pref != null) { // Preferred locale is application-based match = findFormattingMatch(pref, availableFormattingLocales); } else { // Preferred locales are browser-based match = findFormattingMatch(pc, availableFormattingLocales); } if (match == null) { //Use fallback locale. pref = getLocale(pc, Config.FMT_FALLBACK_LOCALE); if (pref != null) { match = findFormattingMatch(pref, availableFormattingLocales); } } if (match != null) { setResponseLocale(pc, match); } return match; }
@Override public void release() { init(); }
Tag parent = findAncestorWithClass(fromTag, BundleSupport.class); if (parent != null) { if (locCtxt.getLocale() != null) { if (format) { setResponseLocale(pc, locCtxt.getLocale()); if (locCtxt.getLocale() != null) { if (format) { setResponseLocale(pc, locCtxt.getLocale()); Locale pref = getLocale(pc, Config.FMT_LOCALE); if (pref != null) { match = findFormattingMatch(pref, avail); } else { match = findFormattingMatch(pc, avail); pref = getLocale(pc, Config.FMT_FALLBACK_LOCALE); if (pref != null) { match = findFormattingMatch(pref, avail); setResponseLocale(pc, match);
public int doEndTag() throws JspException { Locale locale = null; if (value == null) { locale = Locale.getDefault(); } else if (value instanceof String) { if (((String) value).trim().equals("")) { locale = Locale.getDefault(); } else { locale = parseLocale((String) value, variant); } } else { locale = (Locale) value; } Config.set(pageContext, Config.FMT_LOCALE, locale, scope); setResponseLocale(pageContext, locale); return EVAL_PAGE; }
Locale locale = SetLocaleSupport.getFormattingLocale(pageContext, this, true,
@Override public void doTag() throws JspException, IOException { if (locale != null) { Locale locale = SetLocaleSupport.parseLocale(this.locale); prettyTime.setLocale(locale); } JspWriter out = getJspContext().getOut(); out.print(prettyTime.format(date)); }
public int doStartTag() throws JspException { // evaluate any expressions we were passed, once per invocation evaluateExpressions(); // chain to the parent implementation return super.doStartTag(); }
Locale pref = SetLocaleSupport.getLocale(pc, Config.FMT_LOCALE); if (pref != null) { pref = SetLocaleSupport.getLocale(pc, Config.FMT_FALLBACK_LOCALE); if (pref != null) { bundle = findMatch(basename, pref); SetLocaleSupport.setResponseLocale(pc, locCtxt.getLocale());
private static Locale findFormattingMatch(PageContext pageContext, Locale[] avail) { Locale match = null; for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest)pageContext.getRequest()); enum_.hasMoreElements(); ) { Locale locale = (Locale)enum_.nextElement(); match = findFormattingMatch(locale, avail); if (match != null) { break; } } return match; }
@Override public int doEndTag() throws JspException { Locale locale; if (value instanceof Locale) { locale = (Locale) value; } else if (value instanceof String && !"".equals(((String)value).trim())) { locale = LocaleUtil.parseLocale((String) value, variant); } else { locale = Locale.getDefault(); } Config.set(pageContext, Config.FMT_LOCALE, locale, scope); setResponseLocale(pageContext, locale); return EVAL_PAGE; }
Tag parent = findAncestorWithClass(fromTag, BundleSupport.class); if (parent != null) { if (locCtxt.getLocale() != null) { if (format) { setResponseLocale(pc, locCtxt.getLocale()); if (locCtxt.getLocale() != null) { if (format) { setResponseLocale(pc, locCtxt.getLocale()); Locale pref = getLocale(pc, Config.FMT_LOCALE); Locale[] avail = null; if (isDate) { match = findFormattingMatch(pref, avail); } else { match = findFormattingMatch(pc, avail); pref = getLocale(pc, Config.FMT_FALLBACK_LOCALE); if (pref != null) { match = findFormattingMatch(pref, avail); setResponseLocale(pc, match);
public int doEndTag() throws JspException { Locale locale = null; if (value == null) { locale = Locale.getDefault(); } else if (value instanceof String) { if (((String) value).trim().equals("")) { locale = Locale.getDefault(); } else { locale = parseLocale((String) value, variant); } } else { locale = (Locale) value; } Config.set(pageContext, Config.FMT_LOCALE, locale, scope); setResponseLocale(pageContext, locale); return EVAL_PAGE; }
Locale locale = SetLocaleSupport.getFormattingLocale(pageContext, this, true,
/** * See parseLocale(String, String) for details. */ public static Locale parseLocale(String locale) { return parseLocale(locale, null); }
public int doStartTag() throws JspException { // evaluate any expressions we were passed, once per invocation evaluateExpressions(); // chain to the parent implementation return super.doStartTag(); }
private static Locale findFormattingMatch(PageContext pageContext, Locale[] avail) { Locale match = null; for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest)pageContext.getRequest()); enum_.hasMoreElements(); ) { Locale locale = (Locale)enum_.nextElement(); match = findFormattingMatch(locale, avail); if (match != null) { break; } } return match; }
@Override public int doEndTag() throws JspException { Locale locale; if (value instanceof Locale) { locale = (Locale) value; } else if (value instanceof String && !"".equals(((String)value).trim())) { locale = LocaleUtil.parseLocale((String) value, variant); } else { locale = Locale.getDefault(); } Config.set(pageContext, Config.FMT_LOCALE, locale, scope); setResponseLocale(pageContext, locale); return EVAL_PAGE; }
Tag parent = findAncestorWithClass(fromTag, BundleSupport.class); if (parent != null) { if (locCtxt.getLocale() != null) { if (format) { setResponseLocale(pc, locCtxt.getLocale()); if (locCtxt.getLocale() != null) { if (format) { setResponseLocale(pc, locCtxt.getLocale()); Locale pref = getLocale(pc, Config.FMT_LOCALE); if (pref != null) { match = findFormattingMatch(pref, avail); } else { match = findFormattingMatch(pc, avail); pref = getLocale(pc, Config.FMT_FALLBACK_LOCALE); if (pref != null) { match = findFormattingMatch(pref, avail); setResponseLocale(pc, match);
static Locale getFormattingLocale(PageContext pc) { /* * Establish formatting locale by comparing the preferred locales * (in order of preference) against the available formatting * locales, and determining the best matching locale. */ Locale match = null; Locale pref = getLocale(pc, Config.FMT_LOCALE); if (pref != null) { // Preferred locale is application-based match = findFormattingMatch(pref, availableFormattingLocales); } else { // Preferred locales are browser-based match = findFormattingMatch(pc, availableFormattingLocales); } if (match == null) { //Use fallback locale. pref = getLocale(pc, Config.FMT_FALLBACK_LOCALE); if (pref != null) { match = findFormattingMatch(pref, availableFormattingLocales); } } if (match != null) { setResponseLocale(pc, match); } return match; }