use of com.vaadin.flow.server.SystemMessagesProvider in project flow by vaadin.
the class ApplicationRunnerServlet method createServletService.
@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration) throws ServiceException {
VaadinServletService service = super.createServletService(deploymentConfiguration);
final SystemMessagesProvider provider = service.getSystemMessagesProvider();
service.setSystemMessagesProvider((SystemMessagesProvider) systemMessagesInfo -> {
if (systemMessagesInfo.getRequest() == null) {
return provider.getSystemMessages(systemMessagesInfo);
}
Object messages = systemMessagesInfo.getRequest().getAttribute(CUSTOM_SYSTEM_MESSAGES_PROPERTY);
if (messages instanceof SystemMessages) {
return (SystemMessages) messages;
}
return provider.getSystemMessages(systemMessagesInfo);
});
return service;
}
Aggregations