Example usage for org.springframework.web.servlet.i18n CookieLocaleResolver setCookieName

List of usage examples for org.springframework.web.servlet.i18n CookieLocaleResolver setCookieName

Introduction

In this page you can find the example usage for org.springframework.web.servlet.i18n CookieLocaleResolver setCookieName.

Prototype

public void setCookieName(@Nullable String cookieName) 

Source Link

Document

Use the given name for cookies created by this generator.

Usage

From source file:cn.edu.zjnu.acm.judge.config.LocaleConfiguration.java

@Bean(name = "localeResolver")
public LocaleResolver localeResolver(ServletContext container, LocaleFactory localeFactory) {
    CookieLocaleResolver localeResolver = new CookieLocaleResolver();
    localeResolver.setCookieName("locale");
    localeResolver.setCookieMaxAge(15 * 24 * 60 * 60);
    localeResolver.setCookiePath(getCookiePath(container));
    return new FilterLocaleResolver(localeResolver, Locale.SIMPLIFIED_CHINESE,
            locale -> localeFactory.getAllLanguages().contains(locale.getLanguage()));
}

From source file:com.uimirror.auth.conf.DispatcherConfig.java

@Bean(name = "localeResolver")
public LocaleResolver sessionLocaleResolver() {
    CookieLocaleResolver localeResolver = new CookieLocaleResolver();
    localeResolver.setDefaultLocale(new Locale("en"));
    localeResolver.setCookieName("uim_locale");
    localeResolver.setCookieMaxAge(36000);
    return localeResolver;
}

From source file:rashjz.info.com.az.config.SpringWebConfig.java

@Bean
public LocaleResolver localeResolver() {
    CookieLocaleResolver resolver = new CookieLocaleResolver();
    resolver.setDefaultLocale(new Locale("en"));
    resolver.setCookieName("myLocaleCookie");
    resolver.setCookieMaxAge(4800);/*from   w  w  w . j  a v  a2  s  . c o  m*/
    return resolver;
}

From source file:org.openlmis.fulfillment.Application.java

/**
 * Creates new LocaleResolver./* ww w  .  java2 s.  c  om*/
 *
 * @return Created LocalResolver.
 */
@Bean
public LocaleResolver localeResolver() {
    CookieLocaleResolver lr = new CookieLocaleResolver();
    lr.setCookieName("lang");
    lr.setDefaultLocale(locale);
    return lr;
}

From source file:it.f2informatica.webapp.WebApplicationConfig.java

@Bean
public CookieLocaleResolver localeResolver() {
    CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
    cookieLocaleResolver.setCookieName(CURRENT_LOCALE_COOKIE);
    return cookieLocaleResolver;
}

From source file:de.interseroh.report.webconfig.WebMvcConfig.java

@Bean
public LocaleResolver localeResolver() {
    Locale.setDefault(Locale.ENGLISH);
    CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
    cookieLocaleResolver.setCookieName("reportengine-language");
    return cookieLocaleResolver;
}

From source file:com.isalnikov.config.web.WebConfig.java

@Bean
public LocaleResolver localeResolver() {
    CookieLocaleResolver localeResolver = new CookieLocaleResolver();
    localeResolver.setDefaultLocale(new Locale("ru")); // change this Locale.ENGLISH)
    localeResolver.setCookieName("terminal_cookie");
    localeResolver.setCookieMaxAge(60 * 30);
    return localeResolver;
}

From source file:com.MockGatewayApplication.java

@Bean
public LocaleResolver localeResolver() {
    CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
    cookieLocaleResolver.setDefaultLocale(StringUtils.parseLocaleString("en"));
    cookieLocaleResolver.setCookieName("gatewayLanguage");
    cookieLocaleResolver.setCookieMaxAge(604800);//one month
    return cookieLocaleResolver;
}

From source file:com.alehuo.wepas2016projekti.configuration.DevelopmentConfiguration.java

/**
 * Lokalisaatioevsteen asetus/* w  w  w. j ava  2s. c  o m*/
 * 
 * Oletusarvoinen lokalisaatio: fi_FI
 * 
 * @return 
 */
@Bean
public CookieLocaleResolver localeResolver() {
    CookieLocaleResolver localeResolver = new CookieLocaleResolver();
    Locale finnishLocale = new Locale.Builder().setLanguage("fi").setRegion("FI").build();
    localeResolver.setDefaultLocale(finnishLocale);
    localeResolver.setCookieName("locale");
    //Evste vanhenee tunnissa
    localeResolver.setCookieMaxAge(3600);
    return localeResolver;
}