List of usage examples for com.vaadin.server SessionInitListener SessionInitListener
SessionInitListener
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 ww . j a va 2s . c om 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: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// ww w. j a va 2 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:info.magnolia.ui.admincentral.AdmincentralVaadinServlet.java
License:Open Source License
@Override protected void servletInitialized() throws ServletException { super.servletInitialized(); getService().addSessionInitListener(new SessionInitListener() { @Override/*ww w.j a v a 2 s . c o 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:org.vaadin.alump.vibrate.demo.VibrateServlet.java
License:Apache License
@Override protected void servletInitialized() throws ServletException { super.servletInitialized(); getService().addSessionInitListener(new SessionInitListener() { @Override/* www . java 2 s .c o m*/ public void sessionInit(SessionInitEvent event) { event.getSession().addBootstrapListener(settings); } }); }
From source file:org.vaadin.spring.internal.SpringAwareVaadinServlet.java
License:Apache License
@Override protected void servletInitialized() throws ServletException { getService().addSessionInitListener(new SessionInitListener() { @Override//from w w w . j a va2 s . c om public void sessionInit(SessionInitEvent sessionInitEvent) throws ServiceException { WebApplicationContext webApplicationContext = WebApplicationContextUtils .getWebApplicationContext(getServletContext()); UIScopeAwareUIProvider uiProvider = new UIScopeAwareUIProvider(webApplicationContext); sessionInitEvent.getSession().addUIProvider(uiProvider); } }); }
From source file:org.vaadin.spring.servlet.SpringAwareVaadinServlet.java
License:Apache License
@Override protected void servletInitialized() throws ServletException { getService().addSessionInitListener(new SessionInitListener() { @Override/*from w ww.ja va 2 s .c o m*/ public void sessionInit(SessionInitEvent sessionInitEvent) throws ServiceException { WebApplicationContext webApplicationContext = WebApplicationContextUtils .getWebApplicationContext(getServletContext()); SpringAwareUIProvider uiProvider = new SpringAwareUIProvider(webApplicationContext); sessionInitEvent.getSession().addUIProvider(uiProvider); } }); }
From source file:org.vaadin.spring.touchkit.servlet.SpringAwareTouchKitServlet.java
License:Apache License
@Override protected void servletInitialized() throws ServletException { super.servletInitialized(); getService().addSessionInitListener(new SessionInitListener() { @Override//from w w w.j a va 2s . c om public void sessionInit(SessionInitEvent sessionInitEvent) throws ServiceException { WebApplicationContext webApplicationContext = WebApplicationContextUtils .getWebApplicationContext(getServletContext()); SpringAwareTouchKitUIProvider uiProvider = new SpringAwareTouchKitUIProvider(webApplicationContext); sessionInitEvent.getSession().addUIProvider(uiProvider); } }); }
From source file:org.vaadin.webinars.springandvaadin.i18n.ui.createTask.CreateTaskServlet.java
License:Apache License
@Override protected void servletInitialized() throws ServletException { final ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); getService().addSessionInitListener(new SessionInitListener() { @Override//w w w.j a v a2s . c o m public void sessionInit(SessionInitEvent sessionInitEvent) throws ServiceException { sessionInitEvent.getSession().addUIProvider(new UIProvider() { @Override public Class<? extends UI> getUIClass(UIClassSelectionEvent uiClassSelectionEvent) { return CreateTaskUi.class; } @Override public UI createInstance(UICreateEvent event) { return context.getBean(event.getUIClass()); } }); } }); }
From source file:org.vaadin.webinars.springandvaadin.i18n.ui.Servlet.java
License:Apache License
@Override protected void servletInitialized() throws ServletException { final ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); try {//from w ww. j av a 2 s. c o m localeResolver = context.getBean(DispatcherServlet.LOCALE_RESOLVER_BEAN_NAME, LocaleResolver.class); } catch (NoSuchBeanDefinitionException e) { localeResolver = new SessionLocaleResolver(); } getService().addSessionInitListener(new SessionInitListener() { @Override public void sessionInit(SessionInitEvent sessionInitEvent) throws ServiceException { sessionInitEvent.getSession().addUIProvider(new UIProvider() { @Override public Class<? extends UI> getUIClass(UIClassSelectionEvent uiClassSelectionEvent) { return I18nUI.class; } @Override public UI createInstance(UICreateEvent event) { return context.getBean(event.getUIClass()); } }); } }); }
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. ja v a 2s.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()); } }); } }