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.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 2 weeks ago
SystemMessagesProvider api question
The pass in SystemMessageInfo.getRequest() got null at some condition. I wonder why design inconsitent api like this.
If I want to localize system message for individual user, I must to solve the locale from request. For example use spring CookieLocaleResolver.
@Override
public SystemMessages getSystemMessages(SystemMessagesInfo systemMessagesInfo) {
CustomizedSystemMessages messages = new CustomizedSystemMessages();
VaadinRequest vr = VaadinService.getCurrentRequest();
Locale locale = LocaleSelector.getLocaleSupported(RequestContextUtils.getLocale((SpringVaadinServletRequest)vr));
// Locale locale;
// if (systemMessagesInfo.getRequest() == null) {
// locale = Locale.US;
// } else {
// locale = LocaleSelector.getLocaleSupported(RequestContextUtils.getLocale((SpringVaadinServletRequest)systemMessagesInfo.getRequest()));
// }
messages.setAuthenticationErrorCaption(messageSource.getMessage("systemmessage.authenticationErrorCaption", null, locale));
Last updated on
You cannot reply to this thread.