本文整理汇总了Java中net.sf.uadetector.service.UADetectorServiceFactory.getResourceModuleParser方法的典型用法代码示例。如果您正苦于以下问题:Java UADetectorServiceFactory.getResourceModuleParser方法的具体用法?Java UADetectorServiceFactory.getResourceModuleParser怎么用?Java UADetectorServiceFactory.getResourceModuleParser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.uadetector.service.UADetectorServiceFactory
的用法示例。
在下文中一共展示了UADetectorServiceFactory.getResourceModuleParser方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Browser
import net.sf.uadetector.service.UADetectorServiceFactory; //导入方法依赖的package包/类
/**
* Create browser object.
*/
public Browser() {
Optional<String> userAgent = BaseUITest.getUserAgent();
if (userAgent.isPresent() && !userAgent.get().isEmpty()) {
// Try to parse the UA
UserAgentStringParser uaParser = UADetectorServiceFactory.getResourceModuleParser();
ReadableUserAgent agent = uaParser.parse(userAgent.get());
// Set the params based on this agent
this.name = agent.getName();
this.version = agent.getVersionNumber().toVersionString();
this.device = agent.getDeviceCategory().getName();
this.platform = agent.getOperatingSystem().getName();
this.platformVersion = agent.getOperatingSystem().getVersionNumber().toVersionString();
} else {
// Fall-back to the Property class
if (BROWSER.isSpecified()) {
this.name = BROWSER.getValue().toLowerCase();
} else {
this.name = DriverSetup.DEFAULT_BROWSER.toString();
}
if (BROWSER_VERSION.isSpecified()) {
this.version = BROWSER_VERSION.getValue();
}
if (DEVICE.isSpecified()) {
this.device = DEVICE.getValue();
}
if (PLATFORM.isSpecified()) {
this.platform = PLATFORM.getValue();
}
if (PLATFORM_VERSION.isSpecified()) {
this.platformVersion = PLATFORM_VERSION.getValue();
}
}
}
示例2: UserAgentParser
import net.sf.uadetector.service.UADetectorServiceFactory; //导入方法依赖的package包/类
public UserAgentParser() {
this(UADetectorServiceFactory.getResourceModuleParser(),
Collections.synchronizedMap(new LinkedHashMap<String, ReadableUserAgent>(MAX_ELEMENTS + 1, 0.75f, true) {
@Override
protected boolean removeEldestEntry(Map.Entry eldest) {
return size() > MAX_ELEMENTS;
}
}));
}
示例3: UserAgentParser
import net.sf.uadetector.service.UADetectorServiceFactory; //导入方法依赖的package包/类
public UserAgentParser() {
this.parser = UADetectorServiceFactory.getResourceModuleParser();
this.cache = new HashMap<String, ReadableUserAgent>();
}
示例4: UserAgentParser
import net.sf.uadetector.service.UADetectorServiceFactory; //导入方法依赖的package包/类
public UserAgentParser() {
resourceModuleParser = UADetectorServiceFactory.getResourceModuleParser();
}
示例5: ReadableUserAgentResolver
import net.sf.uadetector.service.UADetectorServiceFactory; //导入方法依赖的package包/类
/**
* Create resolver with a default parser.
*/
public ReadableUserAgentResolver() {
this.parser = UADetectorServiceFactory.getResourceModuleParser();
}
示例6: BrowserResolver
import net.sf.uadetector.service.UADetectorServiceFactory; //导入方法依赖的package包/类
/** Create resolver with a default parser. */
public BrowserResolver() {
this.parser = UADetectorServiceFactory.getResourceModuleParser();
}
示例7: userAgentStringParser
import net.sf.uadetector.service.UADetectorServiceFactory; //导入方法依赖的package包/类
@Bean(destroyMethod = "shutdown")
public UserAgentStringParser userAgentStringParser() {
return UADetectorServiceFactory.getResourceModuleParser();
}
示例8: userAgentStringParser
import net.sf.uadetector.service.UADetectorServiceFactory; //导入方法依赖的package包/类
@Bean(destroyMethod = "shutdown")
public UserAgentStringParser userAgentStringParser() {
UserAgentStringParser parser = UADetectorServiceFactory.getResourceModuleParser();
UADetectorCache cache = cache(parser);
return new CachedUserAgentStringParser(parser, cache);
}
示例9: AbstractUADetectorCache
import net.sf.uadetector.service.UADetectorServiceFactory; //导入方法依赖的package包/类
protected AbstractUADetectorCache() {
this.parser = UADetectorServiceFactory.getResourceModuleParser();
}