Example usage for com.vaadin.server SystemMessagesProvider SystemMessagesProvider

List of usage examples for com.vaadin.server SystemMessagesProvider SystemMessagesProvider

Introduction

In this page you can find the example usage for com.vaadin.server SystemMessagesProvider SystemMessagesProvider.

Prototype

SystemMessagesProvider

Source Link

Usage

From source file:de.catma.servlet.CatmaApplicationServlet.java

License:Open Source License

@Override
protected void servletInitialized() throws ServletException {
    super.servletInitialized();
    getService().addSessionInitListener(new SessionInitListener() {

        @Override/*from   w w w  .  ja v  a 2s. c om*/
        public void sessionInit(SessionInitEvent event) throws ServiceException {
            event.getSession().addBootstrapListener(new CatmaBootstrapListener());
        }
    });

    getService().setSystemMessagesProvider(new SystemMessagesProvider() {
        @Override
        public SystemMessages getSystemMessages(SystemMessagesInfo systemMessagesInfo) {
            CustomizedSystemMessages messages = new CustomizedSystemMessages();
            try {
                String problemRedirectURL = RepositoryPropertyKey.BaseURL
                        .getValue(RepositoryPropertyKey.BaseURL.getDefaultValue());

                messages.setAuthenticationErrorURL(problemRedirectURL);
                messages.setInternalErrorURL(problemRedirectURL);
                messages.setSessionExpiredURL(problemRedirectURL);
                messages.setCommunicationErrorURL(problemRedirectURL);
                messages.setCookiesDisabledURL(problemRedirectURL);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return messages;
        }
    });

}

From source file:edu.nps.moves.mmowgli.Mmowgli2VaadinServlet.java

License:Open Source License

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

    getService().addSessionInitListener(this);
    getService().addSessionDestroyListener(this);

    ServletContext context = getServletContext();
    appMaster = AppMaster.instance(this, context);// Initialize app master, global across on user sessions on this cluster node
    context.setAttribute(MmowgliConstants.APPLICATION_MASTER_ATTR_NAME, appMaster);
    appMaster.init(context);/*  ww  w  .  ja  v  a2  s .co m*/

    //You can set the system message provider in the servletInitialized() method of a custom
    //servlet class, for example as follows:
    getService().setSystemMessagesProvider(new SystemMessagesProvider() {
        @Override
        public SystemMessages getSystemMessages(SystemMessagesInfo systemMessagesInfo) {
            return new MmowgliSystemMessages();
        }
    });
}

From source file:fr.amapj.view.engine.ui.ValoThemeSessionInitListener.java

License:Open Source License

@Override
public void sessionInit(final SessionInitEvent event) throws ServiceException {
    event.getService().setSystemMessagesProvider(new SystemMessagesProvider() {

        @Override/* w  ww. j  av a  2  s  .  c o m*/
        public SystemMessages getSystemMessages(final SystemMessagesInfo systemMessagesInfo) {
            CustomizedSystemMessages csm = new CustomizedSystemMessages();
            csm.setSessionExpiredNotificationEnabled(false);
            return csm;
        }
    });
    event.getSession().addBootstrapListener(new BootstrapListener() {

        @Override
        public void modifyBootstrapPage(final BootstrapPageResponse response) {
            final Element head = response.getDocument().head();
            head.appendElement("meta").attr("name", "viewport").attr("content",
                    "width=device-width, initial-scale=1");
            head.appendElement("meta").attr("name", "apple-mobile-web-app-capable").attr("content", "yes");
            head.appendElement("meta").attr("name", "apple-mobile-web-app-status-bar-style").attr("content",
                    "black");
        }

        @Override
        public void modifyBootstrapFragment(final BootstrapFragmentResponse response) {
            // TODO Auto-generated method stub
        }
    });
}

From source file:org.freakz.hokan_ng_springboot.bot.Application.java

License:Apache License

/**
 * Provide custom system messages to make sure the application is reloaded when the session expires.
 *///from   w  w w.  j a va  2  s.c  om
@Bean
SystemMessagesProvider systemMessagesProvider() {
    return new SystemMessagesProvider() {
        @Override
        public SystemMessages getSystemMessages(SystemMessagesInfo systemMessagesInfo) {
            CustomizedSystemMessages systemMessages = new CustomizedSystemMessages();
            systemMessages.setSessionExpiredNotificationEnabled(false);
            return systemMessages;
        }
    };
}

From source file:org.jumpmind.metl.ui.init.AppSessionInitListener.java

License:Open Source License

@Override
public void sessionInit(final SessionInitEvent event) throws ServiceException {
    event.getService().setSystemMessagesProvider(new SystemMessagesProvider() {

        private static final long serialVersionUID = 1L;

        @Override/*from  w  ww  . j av a 2  s  . com*/
        public SystemMessages getSystemMessages(final SystemMessagesInfo systemMessagesInfo) {
            CustomizedSystemMessages csm = new CustomizedSystemMessages();
            csm.setSessionExpiredNotificationEnabled(false);
            return csm;
        }
    });
    event.getSession().addBootstrapListener(new BootstrapListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void modifyBootstrapPage(final BootstrapPageResponse response) {
            final Element head = response.getDocument().head();
            head.appendElement("meta").attr("name", "viewport").attr("content",
                    "width=device-width, initial-scale=1");
            head.appendElement("meta").attr("name", "apple-mobile-web-app-capable").attr("content", "yes");
            head.appendElement("meta").attr("name", "apple-mobile-web-app-status-bar-style").attr("content",
                    "black");
        }

        @Override
        public void modifyBootstrapFragment(final BootstrapFragmentResponse response) {
            // TODO Auto-generated method stub
        }
    });
}