本文整理汇总了Java中eu.bitwalker.useragentutils.Browser类的典型用法代码示例。如果您正苦于以下问题:Java Browser类的具体用法?Java Browser怎么用?Java Browser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Browser类属于eu.bitwalker.useragentutils包,在下文中一共展示了Browser类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getUA
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
/**
* getUA
*
* @param fdata
* @param request
*/
private void getUA(StringBuilder fdata, HttpServletRequest request) {
UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
String bwrVersion = userAgent.getBrowserVersion().getMajorVersion();
Browser bwr = userAgent.getBrowser();
String bwrType = bwr.getBrowserType().getName();
String bwrName = bwr.getName();
String bwrEngine = bwr.getRenderingEngine().name();
fdata.append(bwrName).append(";");
fdata.append(bwrType).append(";");
fdata.append(bwrEngine).append(";");
fdata.append(bwrVersion).append(";");
OperatingSystem os = userAgent.getOperatingSystem();
String osName = os.getName();
String deType = os.getDeviceType().getName();
fdata.append(osName).append(";");
fdata.append(deType).append(";");
}
开发者ID:uavorg,项目名称:uavstack,代码行数:29,代码来源:UEMServiceGFHandler.java
示例2: supportsWallet
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
public boolean supportsWallet(String userAgentHeaderValue) {
if (StringUtils.isBlank(userAgentHeaderValue)) {
return false;
}
UserAgent userAgent = new UserAgent(userAgentHeaderValue);
if (userAgent.getOperatingSystem().getDeviceType() == DeviceType.MOBILE
&& userAgent.getOperatingSystem().getGroup() == OperatingSystem.IOS
&& userAgent.getOperatingSystem().getId() >= OperatingSystem.iOS6_IPHONE.getId()) {
return true;
}
Version oldestSafariVersionWithGuaranteedSupport = new Version("6.2", "6", "2"); // Mac OS X 10.8.2 or later required to install this Safari version
if (userAgent.getOperatingSystem() == OperatingSystem.MAC_OS_X
&& userAgent.getBrowser().getGroup() == Browser.SAFARI
&& userAgent.getBrowserVersion().compareTo(oldestSafariVersionWithGuaranteedSupport) >= 0) {
return true;
}
return false;
}
开发者ID:AusDTO,项目名称:citizenship-appointment-server,代码行数:19,代码来源:WalletSupportService.java
示例3: testWithEmptyUserAgent
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
@Test
public void testWithEmptyUserAgent() throws Exception {
mockMvc.perform(get("/test/useragent")
.accept(MediaType.APPLICATION_JSON)
.header(HttpHeaders.USER_AGENT, ""))
.andExpect(status().isOk())
.andExpect(jsonPath("browser").value(Browser.UNKNOWN.name()));
}
开发者ID:theborakompanioni,项目名称:tbk-spring-useragentutils,代码行数:9,代码来源:IntegrationTest.java
示例4: testFirefoxUserAgent
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
@Test
public void testFirefoxUserAgent() throws Exception {
mockMvc.perform(get("/test/useragent")
.accept(MediaType.APPLICATION_JSON)
.header(HttpHeaders.USER_AGENT, UserAgentStrings.FIREFOX))
.andExpect(status().isOk())
.andExpect(jsonPath("browserGroup").value(Browser.FIREFOX.getGroup().name()));
}
开发者ID:theborakompanioni,项目名称:tbk-spring-useragentutils,代码行数:9,代码来源:IntegrationTest.java
示例5: UserAgentResource
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
public UserAgentResource(Browser browser, Browser browserGroup, BrowserType browserType, OperatingSystem operatingSystem, OperatingSystem operatingSystemGroup, DeviceType deviceType) {
this.browser = browser;
this.browserGroup = browserGroup;
this.browserType = browserType;
this.operatingSystem = operatingSystem;
this.operatingSystemGroup = operatingSystemGroup;
this.deviceType = deviceType;
}
开发者ID:theborakompanioni,项目名称:tbk-spring-useragentutils,代码行数:9,代码来源:UserAgentResource.java
示例6: testWithoutUserAgentHeader
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
@Test
public void testWithoutUserAgentHeader() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
userAgentResolverHandlerInterceptor.preHandle(request, new MockHttpServletResponse(), null);
UserAgent currentUserAgent = UserAgentUtils.getCurrentUserAgent(request);
Assert.assertEquals(Browser.UNKNOWN, currentUserAgent.getBrowser());
}
开发者ID:theborakompanioni,项目名称:tbk-spring-useragentutils,代码行数:10,代码来源:UserAgentResolverHandlerInterceptorTest.java
示例7: testWithEmptyUserAgent
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
@Test
public void testWithEmptyUserAgent() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader(HttpHeaders.USER_AGENT, "");
userAgentResolverHandlerInterceptor.preHandle(request, new MockHttpServletResponse(), null);
UserAgent currentUserAgent = UserAgentUtils.getCurrentUserAgent(request);
Assert.assertEquals(Browser.UNKNOWN, currentUserAgent.getBrowser());
}
开发者ID:theborakompanioni,项目名称:tbk-spring-useragentutils,代码行数:11,代码来源:UserAgentResolverHandlerInterceptorTest.java
示例8: testFirefoxUserAgent
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
@Test
public void testFirefoxUserAgent() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader(HttpHeaders.USER_AGENT, UserAgentStrings.FIREFOX);
userAgentResolverHandlerInterceptor.preHandle(request, new MockHttpServletResponse(), null);
UserAgent currentUserAgent = UserAgentUtils.getCurrentUserAgent(request);
Assert.assertEquals(Browser.FIREFOX.getGroup(), currentUserAgent.getBrowser().getGroup());
}
开发者ID:theborakompanioni,项目名称:tbk-spring-useragentutils,代码行数:11,代码来源:UserAgentResolverHandlerInterceptorTest.java
示例9: isBrowserSupported
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
/**
* Returns true if the browser is supported by dawg-show. Browser compatibility is mainly
* determined by its ability to show the motion jpeg from the axis video server.
* @param userAgentString The user agent string that will be parsed
* @return
*/
public static boolean isBrowserSupported(String userAgentString) {
UserAgent ua = UserAgent.parseUserAgentString(userAgentString);
OperatingSystem osGroup = ua.getOperatingSystem().getGroup();
Browser browser = ua.getBrowser();
Set<Browser> supportedBrowsers = SUPPORTED.get(osGroup);
return (supportedBrowsers != null) && supportedBrowsers.contains(browser.getGroup()) && !UNSUPPORTED.contains(browser);
}
开发者ID:Comcast,项目名称:dawg,代码行数:14,代码来源:BrowserSupport.java
示例10: isLteIE8
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
/**
* 是否IE版本是否小于等于IE8
* @param request
* @return
*/
public static boolean isLteIE8(HttpServletRequest request){
Browser browser = getBrowser(request);
return Browser.IE5.equals(browser) || Browser.IE6.equals(browser)
|| Browser.IE7.equals(browser) || Browser.IE8.equals(browser);
}
开发者ID:EleTeam,项目名称:Shop-for-JavaWeb,代码行数:11,代码来源:UserAgentUtils.java
示例11: testWithoutUserAgent
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
@Test
public void testWithoutUserAgent() throws Exception {
mockMvc.perform(get("/test/useragent").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("browser").value(Browser.UNKNOWN.name()));
}
开发者ID:theborakompanioni,项目名称:tbk-spring-useragentutils,代码行数:7,代码来源:IntegrationTest.java
示例12: getBrowser
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
public Browser getBrowser() {
return this.browser;
}
开发者ID:theborakompanioni,项目名称:tbk-spring-useragentutils,代码行数:4,代码来源:UserAgentResource.java
示例13: getBrowserGroup
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
public Browser getBrowserGroup() {
return this.browserGroup;
}
开发者ID:theborakompanioni,项目名称:tbk-spring-useragentutils,代码行数:4,代码来源:UserAgentResource.java
示例14: getBrowser
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
@Nonnull
public Browser getBrowser() {
return userAgent.getBrowser();
}
开发者ID:indeedeng,项目名称:proctor-pipet,代码行数:5,代码来源:UserAgent.java
示例15: getBrowser
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
/**
* 获取浏览类型
*
* @param request
* @return
*/
public static Browser getBrowser(HttpServletRequest request) {
return getUserAgent(request).getBrowser();
}
开发者ID:funtl,项目名称:framework,代码行数:10,代码来源:UserAgentUtils.java
示例16: isLteIE8
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
/**
* 是否IE版本是否小于等于IE8
*
* @param request
* @return
*/
public static boolean isLteIE8(HttpServletRequest request) {
Browser browser = getBrowser(request);
return Browser.IE5.equals(browser) || Browser.IE6.equals(browser) || Browser.IE7.equals(browser) || Browser.IE8.equals(browser);
}
开发者ID:funtl,项目名称:framework,代码行数:11,代码来源:UserAgentUtils.java
示例17: getBrowser
import eu.bitwalker.useragentutils.Browser; //导入依赖的package包/类
/**
* 获取浏览类型
* @param request
* @return
*/
public static Browser getBrowser(HttpServletRequest request){
return getUserAgent(request).getBrowser();
}
开发者ID:EleTeam,项目名称:Shop-for-JavaWeb,代码行数:9,代码来源:UserAgentUtils.java
注:本文中的eu.bitwalker.useragentutils.Browser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论