Example usage for com.vaadin.server SessionInitEvent getSession

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

Introduction

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

Prototype

public VaadinSession getSession() 

Source Link

Document

Gets the Vaadin service session that has been initialized.

Usage

From source file:fr.univlorraine.mondossierweb.utils.MDWTouchkitServlet.java

License:Apache License

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

    getService().addSessionInitListener(new SessionInitListener() {

        private static final long serialVersionUID = 3292761415754953448L;

        @Override//from  ww  w .j av a2 s . c  o  m
        public void sessionInit(SessionInitEvent event) throws ServiceException {
            event.getSession().addUIProvider(new MdwTouchkitUIProvider(
                    WebApplicationContextUtils.getWebApplicationContext(getServletContext())));
            LOG.debug("UI Provider : " + event.getSession().getUIProviders().size() + "  -  "
                    + event.getSession().getUIProviders());
        }
    });

    TouchKitSettings s = getTouchKitSettings();
    s.getWebAppSettings().setWebAppCapable(true);
    s.getApplicationCacheSettings().setCacheManifestEnabled(true);

}

From source file:in.virit.vwscdn.client.SessionInitListener.java

@Override
public void sessionInit(SessionInitEvent event) {
    event.getSession().addBootstrapListener(new BootstrapListener() {
        @Override/* w  w  w  . j  av a 2s  .  co m*/
        public void modifyBootstrapFragment(BootstrapFragmentResponse response) {
        }

        @Override
        public void modifyBootstrapPage(BootstrapPageResponse response) {
            // Update the bootstrap page
            if (ws != null && ws.getStatus() == PublishState.AVAILABLE) {
                Document document = response.getDocument();
                Element scriptTag = document.getElementsByTag("script").last();
                String script = scriptTag.html();
                scriptTag.html("");
                script = script.replaceAll("\"widgetset\": \".*\"",
                        "\"widgetset\": \"" + ws.getWidgetSetName() + "\"");
                script = script.replace("});", ",\"widgetsetUrl\":\"" + ws.getWidgetSetUrl() + "\"});");
                scriptTag.appendChild(new DataNode(script, scriptTag.baseUri()));
            }
        }
    });
}

From source file:info.magnolia.ui.admincentral.AdmincentralVaadinServlet.java

License:Open Source License

@Override
protected void servletInitialized() throws ServletException {
    super.servletInitialized();
    getService().addSessionInitListener(new SessionInitListener() {
        @Override// www . j  a  v  a2  s. co m
        public void sessionInit(SessionInitEvent event) {
            event.getSession().addBootstrapListener(new BootstrapListener() {

                @Override
                public void modifyBootstrapPage(BootstrapPageResponse response) {
                    response.getDocument().head().append(
                            "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\" />");
                }

                @Override
                public void modifyBootstrapFragment(BootstrapFragmentResponse response) {
                }
            });

            // Set up and configure UIProvider for the admincentral
            if (admincentralUiProvider != null) {
                event.getSession().addUIProvider(admincentralUiProvider);
            } else {
                log.error("Could not inject AdmincentralUIProvider.");
            }
        }
    });
}

From source file:makeithappen.vaadin.app.internal.servlet.VaadinOsgiServletService.java

License:Open Source License

@Override
public void sessionInit(SessionInitEvent event) throws ServiceException {
    event.getSession().addUIProvider(new VaadinOsgiUIProvider());

}

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 www  .ja v  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() {
        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
        }
    });
}

From source file:org.lucidj.vaadinui.BaseVaadinServlet.java

License:Apache License

@Override
public void sessionInit(SessionInitEvent sessionInitEvent) throws ServiceException {
    VaadinSession session = sessionInitEvent.getSession();
    session.addUIProvider(default_provider);

    // Create our own GlobalRequestHandler, extended to handle OSGi issues
    if (!new GlobalResourceHandlerEx().hook(session)) {
        log.error("Error setting OSGi resource handler; you may find problems retrieving class resources.");
    }/*from  ww  w . j av  a 2  s  .  c  o  m*/
}

From source file:org.mpavel.app.web.ApplicationServlet.java

License:Apache License

@Override
public void sessionInit(SessionInitEvent event) throws ServiceException {
    logger.executionTrace();//from   w w w.j  av a2s  .  com
    event.getSession().addUIProvider(applicationProvider);
}

From source file:org.opencms.main.CmsUIServlet.java

License:Open Source License

/**
 * @see com.vaadin.server.SessionInitListener#sessionInit(com.vaadin.server.SessionInitEvent)
 *///from  w ww .ja v a2  s.c o  m
public void sessionInit(final SessionInitEvent event) {

    // set the locale to the users workplace locale
    Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject());
    event.getSession().setLocale(wpLocale);
    event.getSession().addRequestHandler(REQUEST_AUTHORIZATION_HANDLER);
    event.getSession().addUIProvider(LOGIN_UI_PROVIDER);
    event.getSession().addBootstrapListener(BOOTSTRAP_LISTENER);
}

From source file:org.solrsystem.ingest.vaadin.IngestServlet.java

License:Apache License

@Override
public void sessionInit(SessionInitEvent event) throws ServiceException {
    event.getSession().addUIProvider(provider);
}

From source file:org.vaadin.alump.vibrate.demo.VibrateServlet.java

License:Apache License

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

    getService().addSessionInitListener(new SessionInitListener() {
        @Override/*from  w w  w. j  a va2s .c om*/
        public void sessionInit(SessionInitEvent event) {
            event.getSession().addBootstrapListener(settings);
        }
    });
}