nl.bitwalker.useragentutils.UserAgent Java Examples
The following examples show how to use
nl.bitwalker.useragentutils.UserAgent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseWebController.java From black-shop with Apache License 2.0 | 5 votes |
/** * 获取浏览器信息 * * @return */ public String webBrowserInfo(HttpServletRequest request) { // 获取浏览器信息 Browser browser = UserAgent.parseUserAgentString(request.getHeader("User-Agent")).getBrowser(); // 获取浏览器版本号 Version version = browser.getVersion(request.getHeader("User-Agent")); String info = browser.getName() + "/" + version.getVersion(); return info; }
Example #2
Source File: UserAgentUtils.java From super-cloudops with Apache License 2.0 | 2 votes |
/** * Get the user agent object * * @param request * @return */ public static UserAgent getUserAgent(HttpServletRequest request) { String uaString = request.getHeader("User-Agent"); return uaString == null ? null : UserAgent.parseUserAgentString(uaString); }
Example #3
Source File: UserAgentUtils.java From super-cloudops with Apache License 2.0 | 2 votes |
/** * Get device type * * @param request * @return */ public static DeviceType getDeviceType(HttpServletRequest request) { UserAgent ua = getUserAgent(request); return (ua == null ? null : (ua.getOperatingSystem() == null ? null : ua.getOperatingSystem()).getDeviceType()); }
Example #4
Source File: UserAgentUtils.java From super-cloudops with Apache License 2.0 | 2 votes |
/** * Get the browsing type * * @param request * @return */ public static Browser getBrowser(HttpServletRequest request) { UserAgent ua = getUserAgent(request); return (ua != null && ua.getBrowser() != null && ua.getBrowser() != Browser.UNKNOWN) ? ua.getBrowser() : null; }