Example usage for com.vaadin.server VaadinSession addUIProvider

List of usage examples for com.vaadin.server VaadinSession addUIProvider

Introduction

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

Prototype

public void addUIProvider(UIProvider uiProvider) 

Source Link

Document

Adds a UI provider to this session.

Usage

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

License:Apache License

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

        private static final long serialVersionUID = -6307820453486668084L;

        @Override//  w  w  w .jav a 2s .c o  m
        public void sessionInit(SessionInitEvent sessionInitEvent) throws ServiceException {
            WebApplicationContext webApplicationContext = WebApplicationContextUtils
                    .getWebApplicationContext(getServletContext());

            // remove DefaultUIProvider instances to avoid mapping
            // extraneous UIs if e.g. a servlet is declared as a nested
            // class in a UI class
            VaadinSession session = sessionInitEvent.getSession();
            List<UIProvider> uiProviders = new ArrayList<UIProvider>(session.getUIProviders());
            for (UIProvider provider : uiProviders) {
                // use canonical names as these may have been loaded with
                // different classloaders
                if (DefaultUIProvider.class.getCanonicalName().equals(provider.getClass().getCanonicalName())) {
                    session.removeUIProvider(provider);
                }
            }

            // add Spring UI provider
            SpringUIProvider uiProvider = new MdwUIProvider(webApplicationContext);
            session.addUIProvider(uiProvider);
        }
    });
}

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.");
    }// w w  w  . j  a  v  a  2 s .  c  o  m
}

From source file:org.lunifera.runtime.web.gyrex.vaadin.internal.VaadinOSGiServlet.java

License:Open Source License

@Override
protected OSGiServletService createServletService(DeploymentConfiguration deploymentConfiguration) {
    OSGiServletService service = new OSGiServletService(this, deploymentConfiguration, webAppProperties,
            new OSGiServletService.IVaadinSessionFactory() {
                @Override//from www. ja v a2 s  .  c om
                public VaadinSession createSession(VaadinRequest request,
                        HttpServletRequest httpServletRequest) {
                    VaadinSession session = new VaadinSession(request.getService());
                    for (UiProviderInfo info : tracker.getInfos()) {
                        session.addUIProvider(new OSGiUIProvider(info.getFactory(), info.getProviderClass()));
                    }
                    return session;
                }
            });
    return service;
}

From source file:org.lunifera.runtime.web.vaadin.osgi.servlet.VaadinOSGiServlet.java

License:Open Source License

@Override
protected OSGiServletService createServletService(DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {

    // create the servlet service initialized with the ui provider
    OSGiServletService service = new OSGiServletService(this, deploymentConfiguration,
            new OSGiServletService.IVaadinSessionFactory() {
                @Override/*from   w  w  w  .  j  av  a  2 s . com*/
                public VaadinSession createSession(VaadinRequest request,
                        HttpServletRequest httpServletRequest) {
                    VaadinSession session = new VaadinSession(request.getService());
                    for (UIProvider provider : webApplication.getUiProviders()) {
                        session.addUIProvider(provider);
                    }
                    return session;
                }
            });
    service.init();
    return service;
}

From source file:org.lunifera.runtime.web.vaadin.standalone.servlet.VaadinOSGiServlet.java

License:Open Source License

@Override
protected OSGiServletService createServletService(DeploymentConfiguration deploymentConfiguration) {

    // create the servlet service initialized with the ui provider
    OSGiServletService service = new OSGiServletService(this, deploymentConfiguration,
            new OSGiServletService.IVaadinSessionFactory() {
                @Override//from   w w w  .j  av a 2s. c  o m
                public VaadinSession createSession(VaadinRequest request,
                        HttpServletRequest httpServletRequest) {
                    VaadinSession session = new VaadinSession(request.getService());
                    for (OSGiUIProvider provider : webApplication.getUiProviders()) {
                        session.addUIProvider(provider);
                    }
                    return session;
                }
            });
    return service;
}

From source file:org.semanticsoft.vaaclipse.app.servlet.VaadinOSGiServlet.java

License:Open Source License

@Override
protected OSGiServletService createServletService(DeploymentConfiguration deploymentConfiguration) {

    // create the servlet service initialized with the ui provider
    OSGiServletService service = new OSGiServletService(this, deploymentConfiguration,
            new OSGiServletService.IVaadinSessionFactory() {
                @Override//from   ww w  .  ja  v a  2s.  c  o  m
                public VaadinSession createSession(VaadinRequest request,
                        HttpServletRequest httpServletRequest) {
                    VaadinSession session = new VaadinSession(request.getService());
                    session.addUIProvider(new OSGiUIProvider());
                    return session;
                }
            });
    return service;
}