diff options
author | Thomas <> | 2021-05-27 17:19:01 +0200 |
---|---|---|
committer | Thomas <> | 2021-05-28 13:40:25 +0200 |
commit | 0b1973c22e8f9e799a57629f4653324395b73664 (patch) | |
tree | b7b7cf0d2eeece758dc234ca1a9c35304fc2bae9 /connector | |
parent | 34d5786b43c8562fe007392d7835a051e063f49f (diff) | |
download | National_eIDAS_Gateway-0b1973c22e8f9e799a57629f4653324395b73664.tar.gz National_eIDAS_Gateway-0b1973c22e8f9e799a57629f4653324395b73664.tar.bz2 National_eIDAS_Gateway-0b1973c22e8f9e799a57629f4653324395b73664.zip |
fix broken language selection in GUI
Diffstat (limited to 'connector')
-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 |