Example usage for com.vaadin.server VaadinServletService addSessionInitListener

List of usage examples for com.vaadin.server VaadinServletService addSessionInitListener

Introduction

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

Prototype

public Registration addSessionInitListener(SessionInitListener listener) 

Source Link

Document

Adds a listener that gets notified when a new Vaadin service session is initialized for this service.

Usage

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);
    }// w w w .  ja v  a  2  s .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.peergreen.webconsole.core.osgi.VaadinOSGiServlet.java

License:Open Source License

/**
 * {@inheritDoc}/* ww  w . j a va 2  s.  com*/
 */
@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {

    final VaadinServletService service = super.createServletService(deploymentConfiguration);
    service.addSessionInitListener(new BaseSessionInitListener(provider));

    return service;
}

From source file:de.gedoplan.webclients.vaadin.DemoServlet.java

@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {
    VaadinServletService service = super.createServletService(deploymentConfiguration);
    service.addSessionInitListener(e -> {
        e.getSession().setErrorHandler(new ErrorHandler());
        e.getSession().setConverterFactory(new DemoConverterFactory());
    });/*from w  w w.j  av  a2  s.  com*/
    return service;
}

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

License:Apache License

@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {
    VaadinServletService servletService = super.createServletService(deploymentConfiguration);
    servletService.addSessionInitListener(this);
    return (servletService);
}

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  w w .  j a va2s .  c o  m

    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());
            }
        });
    }
}