Package org.springframework.beans.propertyeditors

Examples of org.springframework.beans.propertyeditors.LocaleEditor


      throw new IllegalStateException(
          "  No LocaleResolver found: not in a DispatcherServlet request? ");
    }
    CmsSite site = CmsUtils.getSite(request);
    String newLocale = site.getLocaleFront();
    LocaleEditor localeEditor = new LocaleEditor();
    localeEditor.setAsText(newLocale);
    localeResolver.setLocale(request, response, (Locale) localeEditor
        .getValue());
    // Proceed in any case.
    return true;
  }
View Full Code Here


   *            模板名称。本地化处理。
   * @return
   */
  public static String getTplPath(MessageSource messageSource, String lang,
      String solution, String dir, String name) {
    LocaleEditor localeEditor = new LocaleEditor();
    localeEditor.setAsText(lang);
    Locale locale = (Locale) localeEditor.getValue();
    return solution + "/" + dir + "/"
        + messageSource.getMessage(name, null, locale) + TPL_SUFFIX;
  }
View Full Code Here

      throw new IllegalStateException(
          "No LocaleResolver found: not in a DispatcherServlet request?");
    }
    CmsSite site = CmsUtils.getSite(request);
    String newLocale = site.getLocaleAdmin();
    LocaleEditor localeEditor = new LocaleEditor();
    localeEditor.setAsText(newLocale);
    localeResolver.setLocale(request, response, (Locale) localeEditor
        .getValue());
    // Proceed in any case.
    return true;
  }
View Full Code Here

    }

    public static Locale getLocale(HttpServletRequest webRequest) {
        if (webRequest.getParameter(SystemParameterNames.getLocale()) != null) {
            try {
                LocaleEditor localeEditor = new LocaleEditor();
                localeEditor.setAsText(webRequest.getParameter(SystemParameterNames.getLocale()));
                Locale locale = (Locale) localeEditor.getValue();
                if (isValidLocale(locale)) {
                    return locale;
                }
            } catch (Exception e) {
                return Locale.SIMPLIFIED_CHINESE;
View Full Code Here

  }

  private void setLanguage(String lan, HttpServletResponse response, HttpServletRequest request) {
    LocaleResolver localeResolver = checkNotNull(RequestContextUtils.getLocaleResolver(request),
        "No LocaleResolver found!");
    LocaleEditor localeEditor = new LocaleEditor();
    String language = StringUtils.defaultIfBlank(lan,
        getConfig().getControllerProperties().getProperty(PROP_CONTROLLER_DEFAULT_LANG));
    localeEditor.setAsText(language);
    localeResolver.setLocale(request, response, (Locale) localeEditor.getValue());
  }
View Full Code Here

    this.defaultEditors.put(Class[].class, new ClassArrayEditor());
    this.defaultEditors.put(Currency.class, new CurrencyEditor());
    this.defaultEditors.put(File.class, new FileEditor());
    this.defaultEditors.put(InputStream.class, new InputStreamEditor());
    this.defaultEditors.put(InputSource.class, new InputSourceEditor());
    this.defaultEditors.put(Locale.class, new LocaleEditor());
    this.defaultEditors.put(Pattern.class, new PatternEditor());
    this.defaultEditors.put(Properties.class, new PropertiesEditor());
    this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor());
    this.defaultEditors.put(TimeZone.class, new TimeZoneEditor());
    this.defaultEditors.put(URI.class, new URIEditor());
View Full Code Here

    this.defaultEditors.put(Class.class, new ClassEditor());
    this.defaultEditors.put(Class[].class, new ClassArrayEditor());
    this.defaultEditors.put(Currency.class, new CurrencyEditor());
    this.defaultEditors.put(File.class, new FileEditor());
    this.defaultEditors.put(InputStream.class, new InputStreamEditor());
    this.defaultEditors.put(Locale.class, new LocaleEditor());
    this.defaultEditors.put(Pattern.class, new PatternEditor());
    this.defaultEditors.put(Properties.class, new PropertiesEditor());
    this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor());
    this.defaultEditors.put(TimeZone.class, new TimeZoneEditor());
    this.defaultEditors.put(URI.class, new URIEditor());
View Full Code Here

    if (newLocale != null) {
      LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request);
      if (localeResolver == null) {
        throw new IllegalStateException("No LocaleResolver found: not in a DispatcherServlet request?");
      }
      LocaleEditor localeEditor = new LocaleEditor();
      localeEditor.setAsText(newLocale);
      localeResolver.setLocale(request, response, (Locale) localeEditor.getValue());
    }
    // Proceed in any case.
    return true;
  }
View Full Code Here

    this.defaultEditors.put(Class[].class, new ClassArrayEditor());
    this.defaultEditors.put(Currency.class, new CurrencyEditor());
    this.defaultEditors.put(File.class, new FileEditor());
    this.defaultEditors.put(InputStream.class, new InputStreamEditor());
    this.defaultEditors.put(InputSource.class, new InputSourceEditor());
    this.defaultEditors.put(Locale.class, new LocaleEditor());
    this.defaultEditors.put(Pattern.class, new PatternEditor());
    this.defaultEditors.put(Properties.class, new PropertiesEditor());
    this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor());
    this.defaultEditors.put(TimeZone.class, new TimeZoneEditor());
    this.defaultEditors.put(URI.class, new URIEditor());
View Full Code Here

    /**
     * Sets the locale used in SOAP fault.
     * @param locale
     */
    public void setLocale(String locale) {
        LocaleEditor localeEditor = new LocaleEditor();
        localeEditor.setAsText(locale);
        this.locale = (Locale) localeEditor.getValue();
    }
View Full Code Here

TOP

Related Classes of org.springframework.beans.propertyeditors.LocaleEditor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.