org.apache.taglibs.standard.tag.common.core.Util.getRequestLocales()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(196)

本文整理了Java中org.apache.taglibs.standard.tag.common.core.Util.getRequestLocales()方法的一些代码示例,展示了Util.getRequestLocales()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getRequestLocales()方法的具体详情如下:
包路径:org.apache.taglibs.standard.tag.common.core.Util
类名称:Util
方法名:getRequestLocales

Util.getRequestLocales介绍

[英]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.
[中]HttpServletRequest。如果请求没有指定首选语言,getLocales()将返回服务器的默认语言环境。我们不想要这种行为,因为它阻止我们使用备用区域设置。因此,如果没有指定首选语言环境,我们需要返回一个空枚举。这样,备用区域设置的逻辑将能够生效。

代码示例

代码示例来源:origin: org.eclipse.jetty.orbit/org.apache.taglibs.standard.glassfish

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;
}

代码示例来源:origin: javax.servlet/com.springsource.javax.servlet.jsp.jstl

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;
}

代码示例来源:origin: org.glassfish.web/javax.servlet.jsp.jstl

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;
}

代码示例来源:origin: org.jboss.spec.javax.servlet.jstl/jboss-jstl-api_1.2_spec

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;
}

代码示例来源:origin: org.apache.taglibs/taglibs-standard-impl

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;
}

代码示例来源:origin: org.glassfish.web/jstl-impl

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;
}

代码示例来源:origin: org.apache.taglibs/com.springsource.org.apache.taglibs.standard

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;
}

代码示例来源:origin: org.bluestemsoftware.open.maven.tparty/jsp-api-2.1

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;
}

代码示例来源:origin: org.glassfish.web/jstl-impl

private static LocalizationContext findMatch(PageContext pageContext,
           String basename) {
LocalizationContext locCtxt = null;

// Determine locale from client's browser settings.
  
for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest)pageContext.getRequest());
   enum_.hasMoreElements(); ) {
  Locale pref = (Locale) enum_.nextElement();
  ResourceBundle match = findMatch(basename, pref);
  if (match != null) {
  locCtxt = new LocalizationContext(match, pref);
  break;
  }
}
    
return locCtxt;
}

代码示例来源:origin: org.glassfish.web/javax.servlet.jsp.jstl

private static LocalizationContext findMatch(PageContext pageContext,
           String basename) {
LocalizationContext locCtxt = null;

// Determine locale from client's browser settings.
  
for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest)pageContext.getRequest());
   enum_.hasMoreElements(); ) {
  Locale pref = (Locale) enum_.nextElement();
  ResourceBundle match = findMatch(basename, pref);
  if (match != null) {
  locCtxt = new LocalizationContext(match, pref);
  break;
  }
}
    
return locCtxt;
}

代码示例来源:origin: javax.servlet/com.springsource.javax.servlet.jsp.jstl

private static LocalizationContext findMatch(PageContext pageContext,
           String basename) {
LocalizationContext locCtxt = null;

// Determine locale from client's browser settings.
  
for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest)pageContext.getRequest());
   enum_.hasMoreElements(); ) {
  Locale pref = (Locale) enum_.nextElement();
  ResourceBundle match = findMatch(basename, pref);
  if (match != null) {
  locCtxt = new LocalizationContext(match, pref);
  break;
  }
}
    
return locCtxt;
}

代码示例来源:origin: org.apache.taglibs/taglibs-standard-impl

private static LocalizationContext findMatch(PageContext pageContext,
                       String basename) {
  LocalizationContext locCtxt = null;
  // Determine locale from client's browser settings.
  for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest) pageContext.getRequest());
     enum_.hasMoreElements();) {
    Locale pref = (Locale) enum_.nextElement();
    ResourceBundle match = findMatch(basename, pref);
    if (match != null) {
      locCtxt = new LocalizationContext(match, pref);
      break;
    }
  }
  return locCtxt;
}

代码示例来源:origin: org.eclipse.jetty.orbit/org.apache.taglibs.standard.glassfish

private static LocalizationContext findMatch(PageContext pageContext,
           String basename) {
LocalizationContext locCtxt = null;

// Determine locale from client's browser settings.
  
for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest)pageContext.getRequest());
   enum_.hasMoreElements(); ) {
  Locale pref = (Locale) enum_.nextElement();
  ResourceBundle match = findMatch(basename, pref);
  if (match != null) {
  locCtxt = new LocalizationContext(match, pref);
  break;
  }
}
    
return locCtxt;
}

代码示例来源:origin: org.bluestemsoftware.open.maven.tparty/jsp-api-2.1

private static LocalizationContext findMatch(PageContext pageContext,
           String basename) {
LocalizationContext locCtxt = null;

// Determine locale from client's browser settings.
  
for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest)pageContext.getRequest());
   enum_.hasMoreElements(); ) {
  Locale pref = (Locale) enum_.nextElement();
  ResourceBundle match = findMatch(basename, pref);
  if (match != null) {
  locCtxt = new LocalizationContext(match, pref);
  break;
  }
}
    
return locCtxt;
}

代码示例来源:origin: org.jboss.spec.javax.servlet.jstl/jboss-jstl-api_1.2_spec

private static LocalizationContext findMatch(PageContext pageContext,
                       String basename) {
  LocalizationContext locCtxt = null;
  // Determine locale from client's browser settings.
  for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest) pageContext.getRequest());
     enum_.hasMoreElements();) {
    Locale pref = (Locale) enum_.nextElement();
    ResourceBundle match = findMatch(basename, pref);
    if (match != null) {
      locCtxt = new LocalizationContext(match, pref);
      break;
    }
  }
  return locCtxt;
}

代码示例来源:origin: org.apache.taglibs/com.springsource.org.apache.taglibs.standard

private static LocalizationContext findMatch(PageContext pageContext,
           String basename) {
LocalizationContext locCtxt = null;

// Determine locale from client's browser settings.
  
for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest)pageContext.getRequest());
   enum_.hasMoreElements(); ) {
  Locale pref = (Locale) enum_.nextElement();
  ResourceBundle match = findMatch(basename, pref);
  if (match != null) {
  locCtxt = new LocalizationContext(match, pref);
  break;
  }
}
    
return locCtxt;
}

相关文章