eu.bitwalker.useragentutils.Browser.getGroup()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中eu.bitwalker.useragentutils.Browser.getGroup()方法的一些代码示例,展示了Browser.getGroup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Browser.getGroup()方法的具体详情如下:
包路径:eu.bitwalker.useragentutils.Browser
类名称:Browser
方法名:getGroup

Browser.getGroup介绍

暂无

代码示例

代码示例来源:origin: HaraldWalker/user-agent-utils

/**
 * @return top level browser family
 */
public Browser getGroup() {
  if (this.parent != null) {
    return parent.getGroup();
  }
  return this;
}

代码示例来源:origin: HaraldWalker/user-agent-utils

/**
 * Detects the detailed version information of the browser. Depends on the userAgent to be available.
 * Returns null if it can not detect the version information.
 * @param userAgentString User-agent string as provided in the request.
 * @return Version
 */
public Version getVersion(String userAgentString) {
  if (userAgentString == null) {
    return null;
  }
  
  if (versionFetcher == null) {
    return getGroup() != this ? getGroup().getVersion(userAgentString) : null;
  }
  return versionFetcher.version(userAgentString);
}

代码示例来源:origin: sanluan/PublicCMS

@Override
public void execute(RenderHandler handler) throws IOException, Exception {
  HttpServletRequest request = handler.getRequest();
  if (null != request) {
    String userAgent = RequestUtils.getUserAgent(request);
    UserAgent ua = UserAgent.parseUserAgentString(userAgent);
    Map<String, Object> map = new HashMap<>();
    map.put("id", ua.getId());
    map.put("browser", ua.getBrowser());
    map.put("browserGroup", ua.getBrowser().getGroup());
    map.put("browserType", ua.getBrowser().getBrowserType());
    map.put("browserVersion", ua.getBrowserVersion());
    map.put("operatingSystem", ua.getOperatingSystem());
    map.put("operatingSystemGroup", ua.getOperatingSystem().getGroup());
    map.put("deviceType", ua.getOperatingSystem().getDeviceType());
    map.put("userAgent", userAgent);
    handler.put("object", map).render();
  }
}

代码示例来源:origin: sanluan/PublicCMS

@Override
public void execute(RenderHandler handler) throws IOException, Exception {
  HttpServletRequest request = handler.getRequest();
  if (null != request) {
    String userAgent = RequestUtils.getUserAgent(request);
    UserAgent ua = UserAgent.parseUserAgentString(userAgent);
    Map<String, Object> map = new HashMap<>();
    map.put("id", ua.getId());
    map.put("browser", ua.getBrowser());
    map.put("browserGroup", ua.getBrowser().getGroup());
    map.put("browserType", ua.getBrowser().getBrowserType());
    map.put("browserVersion", ua.getBrowserVersion());
    map.put("operatingSystem", ua.getOperatingSystem());
    map.put("operatingSystemGroup", ua.getOperatingSystem().getGroup());
    map.put("deviceType", ua.getOperatingSystem().getDeviceType());
    map.put("userAgent", userAgent);
    handler.put("object", map).render();
  }
}

代码示例来源:origin: eu.bitwalker/UserAgentUtils

/**
 * @return top level browser family
 */
public Browser getGroup() {
  if (this.parent != null) {
    return parent.getGroup();
  }
  return this;
}

代码示例来源:origin: eu.bitwalker/UserAgentUtils

/**
 * Detects the detailed version information of the browser. Depends on the userAgent to be available.
 * Returns null if it can not detect the version information.
 * @param userAgentString User-agent string as provided in the request.
 * @return Version
 */
public Version getVersion(String userAgentString) {
  if (versionFetcher == null) {
    return getGroup() != this ? getGroup().getVersion(userAgentString) : null;
  }
  return versionFetcher.version(userAgentString);
}

代码示例来源:origin: com.gitee.zhaohuihua/bdp-general-web

if (userAgent != null) {
  UserAgent ua = new UserAgent(userAgent);
  Browser group = ua.getBrowser().getGroup();
  if (group == Browser.OPERA || group == Browser.FIREFOX) {

代码示例来源:origin: net.shibboleth.idp/idp-authn-api

/**
 * Determines whether this user agent is an instance of the given browser.
 *
 * @param browser browser to check.
 *
 * @return True if this user agent is an instance of the given browser, false otherwise.
 */
public boolean isInstance(@Nonnull final Browser browser) {
  Constraint.isNotNull(browser, "Browser cannot be null");
  if (userAgent == null) {
    return false;
  }
  return userAgent.getBrowser().getGroup().equals(browser) || userAgent.getBrowser().equals(browser);
}

相关文章