List of usage examples for com.vaadin.server WebBrowser getBrowserApplication
public String getBrowserApplication()
From source file:com.esofthead.mycollab.community.shell.view.components.AboutWindow.java
License:Open Source License
public AboutWindow() { MHorizontalLayout content = new MHorizontalLayout().withMargin(true).withFullWidth(); this.setContent(content); Image about = new Image("", new AssetResource(WebResourceIds._about)); MVerticalLayout rightPanel = new MVerticalLayout(); ELabel versionLbl = ELabel.h2(String.format("MyCollab Community Edition %s", MyCollabVersion.getVersion())); Label javaNameLbl = new Label(String.format("%s, %s", System.getProperty("java.vm.name"), System.getProperty("java.runtime.version"))); Label homeFolderLbl = new Label("Home folder: " + FileUtils.getHomeFolder().getAbsolutePath()); WebBrowser browser = Page.getCurrent().getWebBrowser(); Label osLbl = new Label( String.format("%s, %s", System.getProperty("os.name"), browser.getBrowserApplication())); osLbl.addStyleName(UIConstants.LABEL_WORD_WRAP); Div licenseDiv = new Div().appendChild(new Text("Powered by: ")) .appendChild(new A("https://www.mycollab.com").appendText("MyCollab")) .appendChild(new Text(". Open source under GPL license")); Label licenseLbl = new Label(licenseDiv.write(), ContentMode.HTML); Label copyRightLbl = new Label(String.format("© %s - %s MyCollab Ltd. All rights reserved", "2011", new GregorianCalendar().get(Calendar.YEAR) + ""), ContentMode.HTML); rightPanel.with(versionLbl, javaNameLbl, osLbl, homeFolderLbl, licenseLbl, copyRightLbl) .withAlign(copyRightLbl, Alignment.BOTTOM_LEFT); content.with(about, rightPanel).expand(rightPanel); }
From source file:com.hack23.cia.web.impl.ui.application.CitizenIntelligenceAgencyUI.java
License:Apache License
@Override protected void init(final VaadinRequest request) { VaadinSession.getCurrent().setErrorHandler(new UiInstanceErrorHandler(this)); setSizeFull();/*from ww w . j a v a 2s.c om*/ final DiscoveryNavigator navigator = new DiscoveryNavigator(this, this); navigator.addView("", mainView); setNavigator(navigator); final Page currentPage = Page.getCurrent(); final String requestUrl = currentPage.getLocation().toString(); final String language = request.getLocale().getLanguage(); final UserConfiguration userConfiguration = configurationManager.getUserConfiguration(requestUrl, language); currentPage.setTitle( userConfiguration.getAgency().getAgencyName() + ":" + userConfiguration.getPortal().getPortalName() + ":" + userConfiguration.getLanguage().getLanguageName()); if (getSession().getUIs().isEmpty()) { final WebBrowser webBrowser = currentPage.getWebBrowser(); final CreateApplicationSessionRequest serviceRequest = new CreateApplicationSessionRequest(); serviceRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId()); final String ipInformation = WebBrowserUtil.getIpInformation(webBrowser); serviceRequest.setIpInformation(ipInformation); serviceRequest.setUserAgentInformation(webBrowser.getBrowserApplication()); serviceRequest.setLocale(webBrowser.getLocale().toString()); serviceRequest.setOperatingSystem(WebBrowserUtil.getOperatingSystem(webBrowser)); serviceRequest.setSessionType(ApplicationSessionType.ANONYMOUS); final ServiceResponse serviceResponse = applicationManager.service(serviceRequest); LOGGER.info(LOG_INFO_BROWSER_ADDRESS_APPLICATION_SESSION_ID_RESULT, requestUrl, language, ipInformation, webBrowser.getBrowserApplication(), serviceRequest.getSessionId(), serviceResponse.getResult().toString()); } }
From source file:com.haulmont.cuba.web.AbstractConnection.java
License:Apache License
protected String makeClientInfo() { Page page = AppUI.getCurrent().getPage(); WebBrowser webBrowser = page.getWebBrowser(); Configuration configuration = AppBeans.get(Configuration.NAME); GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class); String serverInfo = "Web (" + globalConfig.getWebHostName() + ":" + globalConfig.getWebPort() + "/" + globalConfig.getWebContextName() + ") "; return serverInfo + webBrowser.getBrowserApplication(); }
From source file:com.haulmont.cuba.web.config.WebDeviceInfoProvider.java
License:Apache License
@Nullable @Override/*w w w . j a v a 2s .co m*/ public DeviceInfo getDeviceInfo() { // per request cache HttpServletRequest currentServletRequest = VaadinServletService.getCurrentServletRequest(); if (currentServletRequest == null) { return null; } DeviceInfo deviceInfo = (DeviceInfo) currentServletRequest.getAttribute(DeviceInfoProvider.NAME); if (deviceInfo != null) { return deviceInfo; } Page page = Page.getCurrent(); if (page == null) { return null; } WebBrowser webBrowser = page.getWebBrowser(); DeviceInfo di = new DeviceInfo(); di.setAddress(webBrowser.getAddress()); di.setBrowserApplication(webBrowser.getBrowserApplication()); di.setBrowserMajorVersion(webBrowser.getBrowserMajorVersion()); di.setBrowserMinorVersion(webBrowser.getBrowserMinorVersion()); di.setChrome(webBrowser.isChrome()); di.setChromeFrame(webBrowser.isChromeFrame()); di.setChromeFrameCapable(webBrowser.isChromeFrameCapable()); di.setEdge(webBrowser.isEdge()); di.setFirefox(webBrowser.isFirefox()); di.setOpera(webBrowser.isOpera()); di.setIE(webBrowser.isIE()); if (webBrowser.isWindows()) { di.setOperatingSystem(OperatingSystem.WINDOWS); } else if (webBrowser.isAndroid()) { di.setOperatingSystem(OperatingSystem.ANDROID); } else if (webBrowser.isIOS()) { di.setOperatingSystem(OperatingSystem.IOS); } else if (webBrowser.isMacOSX()) { di.setOperatingSystem(OperatingSystem.MACOSX); } else if (webBrowser.isLinux()) { di.setOperatingSystem(OperatingSystem.LINUX); } di.setIPad(webBrowser.isIPad()); di.setIPhone(webBrowser.isIPhone()); di.setWindowsPhone(webBrowser.isWindowsPhone()); di.setSecureConnection(webBrowser.isSecureConnection()); di.setLocale(webBrowser.getLocale()); di.setScreenHeight(webBrowser.getScreenHeight()); di.setScreenWidth(webBrowser.getScreenWidth()); currentServletRequest.setAttribute(DeviceInfoProvider.NAME, di); return di; }
From source file:com.haulmont.cuba.web.security.ConnectionImpl.java
License:Apache License
protected String makeClientInfo() { // timezone info is passed only on VaadinSession creation WebBrowser webBrowser = getWebBrowserDetails(); //noinspection UnnecessaryLocalVariable String serverInfo = String.format("Web (%s:%s/%s) %s", globalConfig.getWebHostName(), globalConfig.getWebPort(), globalConfig.getWebContextName(), webBrowser.getBrowserApplication()); return serverInfo; }
From source file:com.mycollab.community.shell.view.components.AboutWindow.java
License:Open Source License
public AboutWindow() { MHorizontalLayout content = new MHorizontalLayout().withMargin(true).withFullWidth(); this.setContent(content); Image about = new Image("", new ExternalResource(StorageFactory.generateAssetRelativeLink(WebResourceIds._about))); MVerticalLayout rightPanel = new MVerticalLayout(); ELabel versionLbl = ELabel.h2(String.format("MyCollab Community Edition %s", Version.getVersion())); Label javaNameLbl = new Label(String.format("%s, %s", System.getProperty("java.vm.name"), System.getProperty("java.runtime.version"))); Label homeFolderLbl = new Label("Home folder: " + FileUtils.getHomeFolder().getAbsolutePath()); WebBrowser browser = Page.getCurrent().getWebBrowser(); Label osLbl = new Label( String.format("%s, %s", System.getProperty("os.name"), browser.getBrowserApplication())); osLbl.addStyleName(UIConstants.LABEL_WORD_WRAP); Div licenseDiv = new Div().appendChild(new Text("Powered by: ")) .appendChild(new A("https://www.mycollab.com").appendText("MyCollab")) .appendChild(new Text(". Open source under GPL license")); Label licenseLbl = new Label(licenseDiv.write(), ContentMode.HTML); Label copyRightLbl = new Label(String.format("© %s - %s MyCollab Ltd. All rights reserved", "2011", new GregorianCalendar().get(Calendar.YEAR) + ""), ContentMode.HTML); rightPanel.with(versionLbl, javaNameLbl, osLbl, homeFolderLbl, licenseLbl, copyRightLbl) .withAlign(copyRightLbl, Alignment.BOTTOM_LEFT); content.with(about, rightPanel).expand(rightPanel); }
From source file:de.metas.procurement.webui.LoggingConfiguration.java
License:Open Source License
public void updateMDC() { ////from ww w . j a v a2s .c om // Remote address try { final VaadinRequest vaadinRequest = VaadinService.getCurrentRequest(); if (vaadinRequest != null) { final String remoteAddr = vaadinRequest.getRemoteAddr(); MDC.put(MDC_Param_RemoteAddr, remoteAddr); } } catch (final Exception e) { e.printStackTrace(); MDC.put(MDC_Param_RemoteAddr, "?"); } // // LoggedUser try { final MFSession mfSession = MFProcurementUI.getCurrentMFSession(); if (mfSession != null) { final User user = mfSession.getUser(); if (user != null) { final String email = user.getEmail(); if (email != null) { MDC.put(MDC_Param_LoggedUser, email); } } } } catch (final Exception e) { e.printStackTrace(); MDC.put(MDC_Param_LoggedUser, "?"); } // // UserAgent try { final Page page = Page.getCurrent(); if (page != null) { final WebBrowser webBrowser = page.getWebBrowser(); if (webBrowser != null) { final String userAgent = webBrowser.getBrowserApplication(); MDC.put(MDC_Param_UserAgent, userAgent); } } } catch (final Exception e) { e.printStackTrace(); MDC.put(MDC_Param_UserAgent, "?"); } // // SessionId try { final VaadinSession session = VaadinSession.getCurrent(); if (session != null) { final int sessionId = System.identityHashCode(session); MDC.put(MDC_Param_SessionId, Integer.toString(sessionId)); } } catch (final Exception e) { e.printStackTrace(); MDC.put(MDC_Param_SessionId, "?"); } // // UI Id try { final UI ui = UI.getCurrent(); if (ui != null) { final int uiId = ui.getUIId(); MDC.put(MDC_Param_UIId, Integer.toString(uiId)); } } catch (final Exception e) { e.printStackTrace(); MDC.put(MDC_Param_UIId, "?"); } }
From source file:edu.nps.moves.mmowgli.MmowgliSessionGlobals.java
License:Open Source License
private void deriveBrowserBooleans(WebBrowser webBr) { browserApp = webBr.getBrowserApplication(); browserMiniType = returnBrowserType(webBr); browserOS = returnBrowserOS(webBr);/* www .jav a2 s .co m*/ browserMajVersion = webBr.getBrowserMajorVersion(); browserMajVersionString = "" + browserMajVersion; browserMinVersion = webBr.getBrowserMinorVersion(); browserAddress = webBr.getAddress(); if (browserApp.contains("MSIE 7.0")) { internetExplorer = true; if (browserMajVersion <= 7) internetExplorer7 = true; } }