本文整理汇总了Java中net.sf.uadetector.service.UADetectorServiceFactory类的典型用法代码示例。如果您正苦于以下问题:Java UADetectorServiceFactory类的具体用法?Java UADetectorServiceFactory怎么用?Java UADetectorServiceFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UADetectorServiceFactory类属于net.sf.uadetector.service包,在下文中一共展示了UADetectorServiceFactory类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: InflightRequest
import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
InflightRequest(HttpServletRequest req) {
String query = req.getQueryString();
url = req.getRequestURL() + (query == null ? "" : "?" + query);
startTime = System.currentTimeMillis();
userName = Jenkins.getAuthentication().getName();
referer = req.getHeader("Referer");
String agentHeader = req.getHeader("User-Agent");
userAgent = agentHeader != null ? UADetectorServiceFactory.getResourceModuleParser().parse(agentHeader) : null;
locale = req.getLocale().toString();
}
示例3: addContents
import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
@Override
public void addContents(@NonNull Container result) {
final StaplerRequest currentRequest = Stapler.getCurrentRequest();
if (currentRequest != null) {
result.add(new PrintedContent("browser.md") {
@Override
protected void printTo(PrintWriter out) throws IOException {
out.println("Browser");
out.println("=======");
out.println();
Area screenResolution = Functions.getScreenResolution();
if (screenResolution != null) {
out.println(" * Screen size: " + screenResolution.toString());
}
UserAgentStringParser parser = UADetectorServiceFactory.getResourceModuleParser();
String userAgent = currentRequest.getHeader("User-Agent");
ReadableUserAgent agent = parser.parse(userAgent);
OperatingSystem operatingSystem = agent.getOperatingSystem();
out.println(" * User Agent");
out.println(" - Type: " + agent.getType().getName());
out.println(" - Name: " + agent.getName());
out.println(" - Family: " + agent.getFamily());
out.println(" - Producer: " + agent.getProducer());
out.println(" - Version: " + agent.getVersionNumber().toVersionString());
out.println(" - Raw: `" + userAgent.replaceAll("`", "`") + '`');
out.println(" * Operating System");
out.println(" - Name: " + operatingSystem.getName());
out.println(" - Family: " + operatingSystem.getFamily());
out.println(" - Producer: " + operatingSystem.getProducer());
out.println(" - Version: " + operatingSystem.getVersionNumber().toVersionString());
out.println();
}
});
}
}
示例4: 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;
}
}));
}
示例5: getUADetectorExample
import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
private static ReadableUserAgent getUADetectorExample(String userAgentString) {
UserAgentStringParser userAgentStringParser = UADetectorServiceFactory.getCachingAndUpdatingParser();
return userAgentStringParser.parse(userAgentString);
}
示例6: UserAgentParser
import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
public UserAgentParser() {
this.parser = UADetectorServiceFactory.getResourceModuleParser();
this.cache = new HashMap<String, ReadableUserAgent>();
}
示例7: afterPropertiesSet
import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
parser = UADetectorServiceFactory.getCachingAndUpdatingParser();
}
示例8: UserAgentParser
import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
public UserAgentParser() {
resourceModuleParser = UADetectorServiceFactory.getResourceModuleParser();
}
示例9: ReadableUserAgentResolver
import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
/**
* Create resolver with a default parser.
*/
public ReadableUserAgentResolver() {
this.parser = UADetectorServiceFactory.getResourceModuleParser();
}
示例10: BrowserResolver
import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
/** Create resolver with a default parser. */
public BrowserResolver() {
this.parser = UADetectorServiceFactory.getResourceModuleParser();
}
示例11: userAgentStringParser
import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
@Bean(destroyMethod = "shutdown")
public UserAgentStringParser userAgentStringParser() {
return UADetectorServiceFactory.getResourceModuleParser();
}
示例12: 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);
}
示例13: AbstractUADetectorCache
import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
protected AbstractUADetectorCache() {
this.parser = UADetectorServiceFactory.getResourceModuleParser();
}