diff options
Diffstat (limited to 'connector/src/main/java')
-rw-r--r-- | connector/src/main/java/at/asitplus/eidas/specific/connector/config/StaticResourceConfiguration.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/config/StaticResourceConfiguration.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/config/StaticResourceConfiguration.java index a1e953f1..b4d58cdd 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/config/StaticResourceConfiguration.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/config/StaticResourceConfiguration.java @@ -33,9 +33,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.ReloadableResourceBundleMessageSource; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.i18n.CookieLocaleResolver; import org.thymeleaf.templateresolver.FileTemplateResolver; import at.asitplus.eidas.specific.connector.MsEidasNodeConstants; @@ -50,7 +50,6 @@ import at.gv.egiz.eaaf.core.impl.utils.FileUtils; * */ @Configuration -@EnableWebMvc public class StaticResourceConfiguration implements WebMvcConfigurer { private static final Logger log = LoggerFactory.getLogger(StaticResourceConfiguration.class); private static final String[] CLASSPATH_RESOURCE_LOCATIONS = { @@ -160,6 +159,20 @@ public class StaticResourceConfiguration implements WebMvcConfigurer { } /** + * Get a i18n resolver based on cookies. + * + * @return + */ + @Bean + public CookieLocaleResolver localeResolver() { + final CookieLocaleResolver localeResolver = new CookieLocaleResolver(); + localeResolver.setCookieName("currentLanguage"); + localeResolver.setCookieMaxAge(3600); + return localeResolver; + + } + + /** * Get a Tyhmeleaf Template-Resolver with external configuration path. * * @return |