List of usage examples for com.vaadin.server BootstrapListener BootstrapListener
BootstrapListener
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 ww . ja va 2s .com 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.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.j av a 2s . c om * 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:fi.semantum.strategia.Servlet.java
License:Open Source License
@Override protected void servletInitialized() throws ServletException { super.servletInitialized(); getService().addSessionInitListener(new SessionInitListener() { private static final long serialVersionUID = 8234186352463637883L; @Override//from ww w .ja va 2 s . c o m public void sessionInit(SessionInitEvent event) { event.getSession().addBootstrapListener(new BootstrapListener() { private static final long serialVersionUID = 7535841016176448694L; @Override public void modifyBootstrapFragment(BootstrapFragmentResponse response) { } @Override public void modifyBootstrapPage(BootstrapPageResponse response) { } }); } }); }
From source file:fr.amapj.view.engine.ui.ValoThemeSessionInitListener.java
License:Open Source License
@Override public void sessionInit(final SessionInitEvent event) throws ServiceException { event.getService().setSystemMessagesProvider(new SystemMessagesProvider() { @Override/*ww w .ja v a 2s. c om*/ public SystemMessages getSystemMessages(final SystemMessagesInfo systemMessagesInfo) { CustomizedSystemMessages csm = new CustomizedSystemMessages(); csm.setSessionExpiredNotificationEnabled(false); return csm; } }); event.getSession().addBootstrapListener(new BootstrapListener() { @Override public void modifyBootstrapPage(final BootstrapPageResponse response) { final Element head = response.getDocument().head(); head.appendElement("meta").attr("name", "viewport").attr("content", "width=device-width, initial-scale=1"); head.appendElement("meta").attr("name", "apple-mobile-web-app-capable").attr("content", "yes"); head.appendElement("meta").attr("name", "apple-mobile-web-app-status-bar-style").attr("content", "black"); } @Override public void modifyBootstrapFragment(final BootstrapFragmentResponse response) { // TODO Auto-generated method stub } }); }
From source file:in.virit.vwscdn.client.SessionInitListener.java
@Override public void sessionInit(SessionInitEvent event) { event.getSession().addBootstrapListener(new BootstrapListener() { @Override//from www.j a v a2 s . c o m public void modifyBootstrapFragment(BootstrapFragmentResponse response) { } @Override public void modifyBootstrapPage(BootstrapPageResponse response) { // Update the bootstrap page if (ws != null && ws.getStatus() == PublishState.AVAILABLE) { Document document = response.getDocument(); Element scriptTag = document.getElementsByTag("script").last(); String script = scriptTag.html(); scriptTag.html(""); script = script.replaceAll("\"widgetset\": \".*\"", "\"widgetset\": \"" + ws.getWidgetSetName() + "\""); script = script.replace("});", ",\"widgetsetUrl\":\"" + ws.getWidgetSetUrl() + "\"});"); scriptTag.appendChild(new DataNode(script, scriptTag.baseUri())); } } }); }
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/*from w ww. j av a 2 s. com*/ 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.jpos.qi.QIServlet.java
License:Open Source License
@Override protected void servletInitialized() throws ServletException { super.servletInitialized(); log = Log.getLog(Q2.LOGGER_NAME, "QI"); SLF4JBridgeHandler.install();//from ww w .j a v a2 s .c o m getService().addSessionInitListener( (SessionInitListener) 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"); } })); fixThemeCacheDirectory(); }
From source file:org.jumpmind.metl.ui.init.AppSessionInitListener.java
License:Open Source License
@Override public void sessionInit(final SessionInitEvent event) throws ServiceException { event.getService().setSystemMessagesProvider(new SystemMessagesProvider() { private static final long serialVersionUID = 1L; @Override/* w w w . j a v a 2 s .c o m*/ public SystemMessages getSystemMessages(final SystemMessagesInfo systemMessagesInfo) { CustomizedSystemMessages csm = new CustomizedSystemMessages(); csm.setSessionExpiredNotificationEnabled(false); return csm; } }); event.getSession().addBootstrapListener(new BootstrapListener() { private static final long serialVersionUID = 1L; @Override public void modifyBootstrapPage(final BootstrapPageResponse response) { final Element head = response.getDocument().head(); head.appendElement("meta").attr("name", "viewport").attr("content", "width=device-width, initial-scale=1"); head.appendElement("meta").attr("name", "apple-mobile-web-app-capable").attr("content", "yes"); head.appendElement("meta").attr("name", "apple-mobile-web-app-status-bar-style").attr("content", "black"); } @Override public void modifyBootstrapFragment(final BootstrapFragmentResponse response) { // TODO Auto-generated method stub } }); }