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

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

Introduction

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

Prototype

public void setCookieMaxAge(@Nullable Integer cookieMaxAge) 

Source Link

Document

Use the given maximum age (in seconds) 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);
    return resolver;
}

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/*from   w ww  . j ava 2 s .c om*/
 * 
 * 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;
}