public boolean isAccessKeySafe(final String accessKey) { final UserAgentUtil.UserAgent userAgent = getUserAgent(); if (userAgent != null) { if (userAgent.getBrowser().getBrowserFamily() == UserAgentUtil.BrowserFamily.MSIE) { if (MSIE_RESERVED_KEYS.contains(accessKey)) { return false; } } } return true; }
public static boolean isIe456Or7(String userAgent) { if (StringUtils.isBlank(userAgent)) { return false; } UserAgentUtil userAgentUtil = new UserAgentUtilImpl(); final UserAgentUtil.UserAgent userAgentInfo = userAgentUtil.getUserAgentInfo(userAgent); final UserAgentUtil.Browser browser = userAgentInfo.getBrowser(); return browser.getBrowserFamily() == MSIE && browser.getBrowserMajorVersion().compareTo(MSIE8) < 0; }
private boolean isCurrentRequestIE() { final HttpServletRequest httpRequest = ExecutingHttpRequest.get(); if (httpRequest == null) { return false; } final String userAgent = httpRequest.getHeader(USER_AGENT); final UserAgentUtil userAgentUtil = new UserAgentUtilImpl(); final UserAgentUtil.UserAgent userAgentInfo = userAgentUtil.getUserAgentInfo(userAgent); // force batching if we are on IE, disable otherwise return userAgentInfo.getBrowser().getBrowserFamily().equals(UserAgentUtil.BrowserFamily.MSIE) || userAgentInfo.getBrowser().getBrowserFamily().equals(UserAgentUtil.BrowserFamily.IE); } }
switch (browser.getBrowserFamily())
final UserAgentUtil.BrowserFamily browserFamily = userBrowser.getBrowserFamily(); final UserAgentUtil.BrowserFamily browserToTest = UserAgentUtil.BrowserFamily.valueOf(browser.toUpperCase(Locale.ENGLISH));
/** * Returns TRUE if the browser requires a Filter style opacity statement for PNGs * * <ul> * <li> IE 5 upwards on Windows</li> * </ul> * * @param userAgent the user agent header from the request * @return true if the browser is IE 5+ on Windows */ public static boolean isFilterBasedPngOpacity(String userAgent) { if (StringUtils.isBlank(userAgent)) { return false; } UserAgentUtil userAgentUtil = new UserAgentUtilImpl(); final UserAgentUtil.UserAgent userAgentInfo = userAgentUtil.getUserAgentInfo(userAgent); return userAgentInfo.getOperatingSystem().getOperatingSystemFamily() == WINDOWS && (userAgentInfo.getBrowser().getBrowserFamily() == MSIE || userAgentInfo.getBrowser().getBrowserFamily() == IE); } }
private UserAgentUtil.Browser ignoreMinorVersion(UserAgentUtil.Browser browser) { return new UserAgentUtil.Browser(browser.getBrowserFamily(), browser.getBrowserMajorVersion(), "*"); } }