Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Vaadin 7: Server Push has conflict with Spring i18n
Hello everyone,
i have used the "i18n" example from github to translate the text and it works. In this example the listener "org.springframework.web.context.ContextLoaderListener" has been used.
now i would like to use "server push" on the project. As Push annotation is used, i can update the UI through thread. But the translation doesn't work anymore. I even didn't get any error message.
the evironment is following: JDK8, Tomcat8, Vaadin7.5.5, Spring4.2.1.RELEASE, Maven3
In Method service(..) in @WebServlet class, the value of "localeResolver.resolveLocale(request)
" was still the old locale, when the locale has been changed on UI.
This value should be changed to the current locale but it didn't.
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
final Locale locale = localeResolver.resolveLocale(request);
LocaleContextHolder.setLocale(locale);
ServletRequestAttributes requestAttributes = new ServletRequestAttributes(request);
RequestContextHolder.setRequestAttributes(requestAttributes);
try {
super.service(new HttpServletRequestWrapper(request) {
@Override public Locale getLocale() { return locale; }
}, response); }
finally {
if (!locale.equals(LocaleContextHolder.getLocale())) {
localeResolver.setLocale(request, response, LocaleContextHolder.getLocale());
}
LocaleContextHolder.resetLocaleContext();
RequestContextHolder.resetRequestAttributes(); }
}
any suggestion would be appreciate. Thanks.
Y18
Does it work if you use long polling, which is based on HTTP (as opposed to websockets, which is the default)?
@Push(transport = Transport.LONG_POLLING)