List of usage examples for com.vaadin.server SessionInitEvent getSession
public VaadinSession getSession()
From source file:annis.gui.servlets.AnnisServlet.java
License:Apache License
@Override protected void servletInitialized() throws ServletException { super.servletInitialized(); getService().addSessionInitListener(new SessionInitListener() { @Override// www.j a va 2s .com 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/*ww w . j ava 2 s . co m*/ 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/* www . j a v a 2 s.co m*/ 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 a 2s. c o 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.google.code.vaadin.application.GuiceApplicationServlet.java
License:Apache License
@Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addUIProvider(basicProvider); }
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 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 { //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 a va2 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 { 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 w w w . java 2 s . c o m*/ public void sessionInit(SessionInitEvent event) { event.getSession().addBootstrapListener(new AppBootstrapListener()); event.getSession().addUIProvider(new AppUIProvider()); } }); }
From source file:com.mcparland.john.vaadin_mvn_arch.ViewPortSessionInitListener.java
License:Apache License
@Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addBootstrapListener(new BootstrapListener() { /**//from w ww . java2s . co m * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void modifyBootstrapFragment(BootstrapFragmentResponse response) { } @Override public void modifyBootstrapPage(BootstrapPageResponse response) { // <meta name="viewport" // content="user-scalable=no,initial-scale=1.0"> Document d = response.getDocument(); Element el = d.createElement("meta"); el.attr("name", "viewport"); el.attr("content", getViewPortConfiguration(response)); d.getElementsByTag("head").get(0).appendChild(el); } }); }
From source file:com.peergreen.webconsole.core.osgi.BaseSessionInitListener.java
License:Open Source License
@Override public void sessionInit(SessionInitEvent e) throws ServiceException { // Add Vaadin UI provider to the Vaadin session e.getSession().addUIProvider(provider); e.getSession().setErrorHandler(new VaadinErrorHandler()); e.getSession().addBootstrapListener(new BaseBootstrapListener()); }