Vaadin Change the default Session Expired Notification?

偶尔善良 提交于 2019-12-23 19:45:51

问题


Vaadin 7.6.2

How to change the default Session Expired Notification; both the message and the type of notification?


回答1:


To change session expired message you need to create your own SystemMessagesProvider, where you define it. For example in a servlet deployment, you could do the following:

@WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
public static class MyUIServlet extends VaadinServlet {

    @Override
    protected void servletInitialized() throws ServletException {
        super.servletInitialized();

        CustomizedSystemMessages messages = new CustomizedSystemMessages();
        messages.setSessionExpiredCaption("Session expired caption");
        messages.setSessionExpiredMessage("Session expired more detailed message");

        getService().setSystemMessagesProvider(e -> messages);

    }
}

There is no a built-in way to change the type of notification. Of course you can style it with css, but the styling affects to other system notifications as well.



来源:https://stackoverflow.com/questions/35634364/vaadin-change-the-default-session-expired-notification

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!