List of usage examples for org.apache.wicket.protocol.http ClientProperties isBrowserChrome
@Deprecated public boolean isBrowserChrome()
From source file:com.servoy.j2db.server.headlessclient.ServoyRequestCycle.java
License:Open Source License
/** * @see org.apache.wicket.protocol.http.WebRequestCycle#newClientInfo() *///w ww .ja v a2 s . co m @Override protected ClientInfo newClientInfo() { // We will always do a redirect here. The servoy browser info has to make one. WebClientInfo webClientInfo = new WebClientInfo(this); ClientProperties cp = webClientInfo.getProperties(); if (cp.isBrowserInternetExplorer() || cp.isBrowserMozilla() || cp.isBrowserKonqueror() || cp.isBrowserOpera() || cp.isBrowserSafari() || cp.isBrowserChrome()) { if (cp.isBrowserInternetExplorer() && cp.getBrowserVersionMajor() != -1 && cp.getBrowserVersionMajor() < 7) { // IE6 is no longer supported when anchoring is enabled. boolean enableAnchoring = Utils.getAsBoolean(Settings.getInstance() .getProperty("servoy.webclient.enableAnchors", Boolean.TRUE.toString())); //$NON-NLS-1$ if (enableAnchoring) { throw new RestartResponseException(new UnsupportedBrowserPage("Internet Explorer 6")); //$NON-NLS-1$ } } Page page = getResponsePage(); if (page != null) { throw new RestartResponseAtInterceptPageException( new ServoyBrowserInfoPage(urlFor(page).toString().replaceAll("../", ""))); //$NON-NLS-1$ //$NON-NLS-2$ } else { throw new RestartResponseAtInterceptPageException(new ServoyBrowserInfoPage(getRequest().getURL())); } } return webClientInfo; }
From source file:de.tudarmstadt.ukp.clarin.webanno.webapp.home.page.ApplicationPageBase.java
License:Apache License
@SuppressWarnings({ "serial" }) private void commonInit() { // getSession().setLocale(Locale.ENGLISH); logoutPanel = new LogoutPanel("logoutPanel"); feedbackPanel = new FeedbackPanel("feedbackPanel"); feedbackPanel.setOutputMarkupId(true); feedbackPanel.add(new AttributeModifier("class", "error")); feedbackPanel.setFilter(new IFeedbackMessageFilter() { @Override//from w w w.j ava 2s .c o m public boolean accept(FeedbackMessage aMessage) { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); String username = auth != null ? auth.getName() : "SYSTEM"; if (aMessage.isFatal()) { LOG.fatal(username + ": " + aMessage.getMessage()); } else if (aMessage.isError()) { LOG.error(username + ": " + aMessage.getMessage()); } else if (aMessage.isWarning()) { LOG.warn(username + ": " + aMessage.getMessage()); } else if (aMessage.isInfo()) { LOG.info(username + ": " + aMessage.getMessage()); } else if (aMessage.isDebug()) { LOG.debug(username + ": " + aMessage.getMessage()); } return true; } }); versionLabel = new Label("version", SettingsUtil.getVersionString()); embeddedDbWarning = new Label("embeddedDbWarning", "USE THIS INSTALLATION FOR TESTING ONLY -- " + "AN EMBEDDED DATABASE IS NOT RECOMMENDED FOR PRODUCTION USE"); embeddedDbWarning.setVisible(false); try { String driver = repository.getDatabaseDriverName(); embeddedDbWarning.setVisible(StringUtils.contains(driver.toLowerCase(Locale.US), "hsql")); } catch (Throwable e) { LOG.warn("Unable to determine which database is being used", e); } // Override warning about embedded database. Properties settings = SettingsUtil.getSettings(); if ("false".equalsIgnoreCase(settings.getProperty("warnings.embeddedDatabase"))) { embeddedDbWarning.setVisible(false); } // Display a warning when using an unsupported browser RequestCycle requestCycle = RequestCycle.get(); WebClientInfo clientInfo; if (Session.exists()) { WebSession session = WebSession.get(); clientInfo = session.getClientInfo(); } else { clientInfo = new WebClientInfo(requestCycle); } ClientProperties clientProperties = clientInfo.getProperties(); browserWarning = new Label("browserWarning", "THIS BROWSER IS NOT SUPPORTED -- " + "PLEASE USE CHROME OR SAFARI"); browserWarning.setVisible(!clientProperties.isBrowserSafari() && !clientProperties.isBrowserChrome()); // Override warning about browser. if ("false".equalsIgnoreCase(settings.getProperty("warnings.unsupportedBrowser"))) { browserWarning.setVisible(false); } boolean helpAvailable; try { Application.get().getResourceSettings().getLocalizer().getString("page.help.link", this); Application.get().getResourceSettings().getLocalizer().getString("page.help", this); helpAvailable = true; } catch (MissingResourceException e) { helpAvailable = false; } add(helpLink = new ExternalLink("helpLink", new ResourceModel("page.help.link", ""), new ResourceModel("page.help", ""))); helpLink.setPopupSettings(new PopupSettings("_blank")); helpLink.setVisible(helpAvailable); add(logoutPanel); add(feedbackPanel); add(versionLabel); add(embeddedDbWarning); add(browserWarning); }