Example usage for com.vaadin.server SessionInitEvent getService

List of usage examples for com.vaadin.server SessionInitEvent getService

Introduction

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

Prototype

public VaadinService getService() 

Source Link

Document

Gets the Vaadin service from which this event originates.

Usage

From source file:annis.gui.servlets.AnnisServlet.java

License:Apache License

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

    getService().addSessionInitListener(new SessionInitListener() {

        @Override//from   w  ww  .  ja v a 2  s  . co m
        public void sessionInit(SessionInitEvent event) throws ServiceException {
            VaadinSession session = event.getSession();
            if (Helper.isKickstarter(session)) {
                // only load configurations from the WEB-INF/conf folder
                File config = new File(event.getService().getBaseDirectory(),
                        "/WEB-INF/conf/annis-gui.properties");
                loadPropertyFile(config, session);
                // manually override the service URL if given
                String serviceURL = session.getConfiguration().getInitParameters()
                        .getProperty(Helper.KEY_WEB_SERVICE_URL);
                if (serviceURL != null) {
                    session.setAttribute(Helper.KEY_WEB_SERVICE_URL, serviceURL);
                }
            } else {
                // load some additional properties from our ANNIS configuration
                loadApplicationProperties("annis-gui.properties", session);
            }

            event.getSession().addRequestHandler(new ShortenerRequestHandler());
        }
    });
}

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/*from  ww  w .  j ava 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.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  w w .  j  a  v a  2  s  .  c  om
        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
        }
    });
}