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

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

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

Browser.parseUserAgentString介绍

[英]Iterates over all Browsers to compare the browser signature with the user agent string. If no match can be found Browser.UNKNOWN will be returned. Starts with the top level browsers and only if one of those matches checks children browsers. Steps out of loop as soon as there is a match.
[中]迭代所有浏览器,将浏览器签名与用户代理字符串进行比较。如果在浏览器中找不到匹配项。未知将被返回。从顶级浏览器开始,仅当其中一个匹配项检查子浏览器时。比赛一开始就退出循环。

代码示例

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

/**
 * Iterates over all Browsers to compare the browser signature with
 * the user agent string. If no match can be found Browser.UNKNOWN will
 * be returned.
 * Starts with the top level browsers and only if one of those matches
 * checks children browsers.
 * Steps out of loop as soon as there is a match.
 * @param agentString User-agent sting as provided in the request.
 * @return Browser enum
 */
public static Browser parseUserAgentString(String agentString)
{
  return parseUserAgentString(agentString, topLevelBrowsers);
}

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

/**
 * Iterates over all Browsers to compare the browser signature with
 * the user agent string. If no match can be found Browser.UNKNOWN will
 * be returned.
 * Starts with the top level browsers and only if one of those matches
 * checks children browsers.
 * Steps out of loop as soon as there is a match.
 * @param agentString User-agent sting as provided in the request.
 * @return Browser enum
 */
public static Browser parseUserAgentString(String agentString)
{
  return parseUserAgentString(agentString, topLevelBrowsers);
}

代码示例来源:origin: com.gitee.qdbp/qdbp-base-ctl

String userAgent = request.getHeader("User-Agent");
if (userAgent != null) {
  Browser group = Browser.parseUserAgentString(userAgent);
  if (group == Browser.OPERA || group == Browser.FIREFOX) {

相关文章