Example usage for com.vaadin.server Constants SERVLET_PARAMETER_UI_PROVIDER

List of usage examples for com.vaadin.server Constants SERVLET_PARAMETER_UI_PROVIDER

Introduction

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

Prototype

String SERVLET_PARAMETER_UI_PROVIDER

To view the source code for com.vaadin.server Constants SERVLET_PARAMETER_UI_PROVIDER.

Click Source Link

Usage

From source file:com.haulmont.cuba.web.sys.CubaApplicationServlet.java

License:Apache License

@Override
protected DeploymentConfiguration createDeploymentConfiguration(Properties initParameters) {
    int sessionExpirationTimeout = webConfig.getHttpSessionExpirationTimeoutSec();
    int sessionPingPeriod = sessionExpirationTimeout / 3;

    if (Strings.isNullOrEmpty(initParameters.getProperty(Constants.SERVLET_PARAMETER_HEARTBEAT_INTERVAL))) {
        if (sessionPingPeriod > 0) {
            // configure Vaadin heartbeat according to web config
            initParameters.setProperty(Constants.SERVLET_PARAMETER_HEARTBEAT_INTERVAL,
                    String.valueOf(sessionPingPeriod));
        }/*  w w  w  .j  ava2 s  . c  o  m*/
    }

    if (Strings.isNullOrEmpty(initParameters.getProperty(Constants.PARAMETER_WIDGETSET))) {
        String widgetSet = webConfig.getWidgetSet();
        initParameters.setProperty(Constants.PARAMETER_WIDGETSET, widgetSet);
    }

    if (Strings.isNullOrEmpty(initParameters.getProperty(Constants.SERVLET_PARAMETER_PRODUCTION_MODE))) {
        boolean productionMode = webConfig.getProductionMode();
        if (productionMode) {
            initParameters.setProperty(Constants.SERVLET_PARAMETER_PRODUCTION_MODE, String.valueOf(true));
        }
    }

    if (Strings.isNullOrEmpty(initParameters.getProperty(Constants.SERVLET_PARAMETER_UI_PROVIDER))) {
        initParameters.setProperty(Constants.SERVLET_PARAMETER_UI_PROVIDER,
                CubaUIProvider.class.getCanonicalName());
    }

    if (Strings.isNullOrEmpty(initParameters.getProperty(VaadinSession.UI_PARAMETER))) {
        // not actually used by CubaUIProvider
        initParameters.setProperty(VaadinSession.UI_PARAMETER, AppUI.class.getCanonicalName());
    }

    return super.createDeploymentConfiguration(initParameters);
}

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  va  2s. 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 .  j ava  2s . c  om

    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:pl.exsio.frameset.vaadin.bootstrap.servlet.FramesetServlet.java

License:Open Source License

protected void initializeApplication(VaadinServletService service) {
    if (this.systemMessagesBeanName != null && !"".equals(this.systemMessagesBeanName)) {
        FramesetSystemMessagesProvider messagesProvider = new FramesetSystemMessagesProvider(
                this.applicationContext, this.systemMessagesBeanName);
        service.setSystemMessagesProvider(messagesProvider);
    }/*from   w  ww  .j a v a 2 s  . c  om*/

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

    if (uiProviderProperty == null) {
        service.addSessionInitListener(new SessionInitListener() {
            @Override
            public void sessionInit(SessionInitEvent event) throws ServiceException {
                event.getSession().addUIProvider(new FramesetUIProvider());
            }
        });
    }
}