Example usage for com.vaadin.server SessionInitListener SessionInitListener

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

Introduction

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

Prototype

SessionInitListener

Source Link

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 w  w  . 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:com.esofthead.mycollab.community.vaadin.MyCollabServlet.java

License:Open Source License

@Override
protected void servletInitialized() throws ServletException {
    super.servletInitialized();
    TouchKitSettings s = getTouchKitSettings();
    s.getWebAppSettings().setWebAppCapable(true);
    s.getApplicationCacheSettings().setCacheManifestEnabled(true);
    String contextPath = getServletConfig().getServletContext().getContextPath();
    s.getApplicationIcons().addApplicationIcon(
            contextPath + "VAADIN/themes/" + MyCollabVersion.THEME_MOBILE_VERSION + "/icons/icon.png");
    s.getWebAppSettings().setStartupImage(
            contextPath + "VAADIN/themes/" + MyCollabVersion.THEME_MOBILE_VERSION + "/icons/icon.png");

    getService().addSessionInitListener(new SessionInitListener() {
        private static final long serialVersionUID = 1L;

        @Override//from   ww  w  . j  a  v a  2  s  .c om
        public void sessionInit(SessionInitEvent event) {
            event.getSession().addBootstrapListener(new MyCollabBootstrapListener());
            event.getSession().addUIProvider(uiProvider);
        }
    });
}

From source file:com.esofthead.mycollab.vaadin.MyCollabServlet.java

License:Open Source License

@Override
protected void servletInitialized() throws ServletException {
    super.servletInitialized();
    TouchKitSettings s = getTouchKitSettings();
    s.getApplicationCacheSettings().setCacheManifestEnabled(false);

    getService().addSessionInitListener(new SessionInitListener() {
        private static final long serialVersionUID = 1L;

        @Override//from ww  w .j  av a 2  s.  c om
        public void sessionInit(SessionInitEvent event) {
            event.getSession().addBootstrapListener(new MyCollabBootstrapListener());

            event.getSession().addUIProvider(uiProvider);
        }
    });
}

From source file:com.foc.vaadin.servlet.FocVaadinServlet.java

License:Apache License

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

        @Override/*from  w w w  . j a v  a2 s.  co m*/
        public void sessionInit(SessionInitEvent event) {
            event.getSession().addBootstrapListener(new BootstrapListener() {

                @Override
                public void modifyBootstrapFragment(BootstrapFragmentResponse response) {
                }

                @Override
                public void modifyBootstrapPage(BootstrapPageResponse response) {
                    response.getDocument().head().prependElement("meta").attr("name", "viewport")
                            .attr("content", "width=device-width");
                    String robotKeywords = getRobotKeywords();
                    if (robotKeywords != null && !robotKeywords.isEmpty()) {
                        response.getDocument().head().prependElement("meta").attr("name", "robots")
                                .attr("content", robotKeywords);
                        ;//robots" content="..., ..." /
                    }
                    if (hasAjaxWebCrawlerSupport()) {
                        Element elmt = response.getDocument().head().prependElement("meta");
                        elmt.attr("name", "fragment");
                        elmt.attr("content", "!");
                    }
                }
            });
        }
    });
}

From source file:com.klwork.explorer.web.CustomVaadinServlet.java

License:Apache License

@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {
    final VaadinServletService service = super.createServletService(deploymentConfiguration);

    // Spring system messages provider
    if (systemMessagesBeanName != null && systemMessagesBeanName != "") {
        SpringVaadinSystemMessagesProvider messagesProvider = new SpringVaadinSystemMessagesProvider(
                applicationContext, systemMessagesBeanName);
        logger.debug("set SpringVaadinSystemMessagesProvider");
        service.setSystemMessagesProvider(messagesProvider);
    }//from w  ww. j  a v a2s  . c  o m

    String uiProviderProperty = service.getDeploymentConfiguration()
            .getApplicationOrSystemProperty(Constants.SERVLET_PARAMETER_UI_PROVIDER, null);

    // Add SpringUIProvider if custom provider doesn't defined.
    if (uiProviderProperty == null) {
        service.addSessionInitListener(new SessionInitListener() {
            @Override
            public void sessionInit(SessionInitEvent event) throws ServiceException {
                //UIPROVIDER,CommunicationManager
                event.getSession().addUIProvider(new SpringUIProvider());
            }
        });
    }

    return service;
}

From source file:com.klwork.explorer.web.SpringVaadinPortlet.java

License:Apache License

@Override
protected VaadinPortletService createPortletService(DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {
    final VaadinPortletService service = super.createPortletService(deploymentConfiguration);

    // Spring system messages provider
    if (systemMessagesBeanName != null && systemMessagesBeanName != "") {
        SpringVaadinSystemMessagesProvider messagesProvider = new SpringVaadinSystemMessagesProvider(
                applicationContext, systemMessagesBeanName);
        logger.debug("set SpringVaadinSystemMessagesProvider");
        service.setSystemMessagesProvider(messagesProvider);
    }/*from   w w w . ja  v  a 2 s.  co  m*/

    String uiProviderProperty = service.getDeploymentConfiguration()
            .getApplicationOrSystemProperty(Constants.SERVLET_PARAMETER_UI_PROVIDER, null);

    // Add SpringUIProvider if custom provider doesn't defined.
    if (uiProviderProperty == null) {
        service.addSessionInitListener(new SessionInitListener() {
            @Override
            public void sessionInit(SessionInitEvent event) throws ServiceException {
                event.getSession().addUIProvider(new SpringUIProvider());
            }
        });
    }

    return service;
}

From source file:com.lst.deploymentautomation.vaadin.core.AppServlet.java

License:Open Source License

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

    //register a bootstrap listener that adds a meta header to the bootstrap page
    getService().addSessionInitListener(new SessionInitListener() {

        private static final long serialVersionUID = 1L;

        @Override//from  ww w .j av a 2s  .  c om
        public void sessionInit(SessionInitEvent event) {
            event.getSession().addBootstrapListener(new AppBootstrapListener());
            event.getSession().addUIProvider(new AppUIProvider());
        }
    });
}

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//  w w w  .j  a  v a2 s.com
        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:de.unioninvestment.eai.portal.support.vaadin.CrudVaadinPortlet.java

License:Apache License

@Override
protected void portletInitialized() throws PortletException {
    super.portletInitialized();
    getService().addSessionInitListener(new SessionInitListener() {
        @Override/*from   w  ww .  j  a  v a 2  s .  co  m*/
        public void sessionInit(SessionInitEvent event) {
            event.getSession().addBootstrapListener(new LoadingIndicatorBootstrapListener());
        }
    });
}

From source file:fi.semantum.strategia.Servlet.java

License:Open Source License

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

        private static final long serialVersionUID = 8234186352463637883L;

        @Override//  w ww .j a  v a  2 s  .  c  o  m
        public void sessionInit(SessionInitEvent event) {
            event.getSession().addBootstrapListener(new BootstrapListener() {

                private static final long serialVersionUID = 7535841016176448694L;

                @Override
                public void modifyBootstrapFragment(BootstrapFragmentResponse response) {
                }

                @Override
                public void modifyBootstrapPage(BootstrapPageResponse response) {
                }
            });
        }
    });
}