Пример #1
0
 private void setLocale(HttpServletRequest request) {
   if (request != null) {
     String superLocale = request.getParameter("locale");
     if (superLocale != null && superLocale.length() > 0) {
       configLocale = Locale.getLocaleObjFromAcceptLangHeader(superLocale);
     } else {
       String acceptLangHeader = (String) request.getHeader("Accept-Language");
       if ((acceptLangHeader != null) && (acceptLangHeader.length() > 0)) {
         configLocale = Locale.getLocaleObjFromAcceptLangHeader(acceptLangHeader);
       } else {
         configLocale = java.util.Locale.getDefault();
       }
     }
     try {
       rb = ResourceBundle.getBundle(RB_NAME, configLocale);
     } catch (MissingResourceException mre) {
       // do nothing
     }
   }
 }
Пример #2
0
 /**
  * Constructor
  *
  * @param lang Language for the properties file.
  */
 public PPInteractionHelper(String lang) {
   if (lang != null) {
     props =
         ResourceBundle.getBundle(
             idppProps,
             com.sun.identity.shared.locale.Locale.getLocaleObjFromAcceptLangHeader(lang));
   } else {
     props = IDPPUtils.bundle;
   }
   try {
     defaultMinChars = props.getString("defaultMinTextChars");
     defaultMaxChars = props.getString("defaultMaxTextChars");
   } catch (MissingResourceException mre) {
     IDPPUtils.debug.error(
         "PPInteractHelper.Static: Could not find min" + " or maximum text characters.", mre);
   }
 }