当前位置: 首页>>代码示例>>Java>>正文


Java UADetectorServiceFactory类代码示例

本文整理汇总了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();
        }
    }
}
 
开发者ID:Frameworkium,项目名称:frameworkium-core,代码行数:40,代码来源:Browser.java

示例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();
}
 
开发者ID:jenkinsci,项目名称:support-core-plugin,代码行数:11,代码来源:InflightRequest.java

示例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("`", "&#96;") + '`');
                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();
            }
        });
    }
}
 
开发者ID:jenkinsci,项目名称:support-core-plugin,代码行数:37,代码来源:AboutBrowser.java

示例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;
				}
			}));
}
 
开发者ID:stagemonitor,项目名称:stagemonitor,代码行数:10,代码来源:UserAgentParser.java

示例5: getUADetectorExample

import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
private static ReadableUserAgent getUADetectorExample(String userAgentString) {
    UserAgentStringParser userAgentStringParser = UADetectorServiceFactory.getCachingAndUpdatingParser();
    return userAgentStringParser.parse(userAgentString);
}
 
开发者ID:sdcuike,项目名称:book-reading,代码行数:5,代码来源:DetectDeviceTypeinJavaWebApplicationI.java

示例6: UserAgentParser

import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
public UserAgentParser() {
  this.parser = UADetectorServiceFactory.getResourceModuleParser();
  this.cache = new HashMap<String, ReadableUserAgent>();
}
 
开发者ID:penzance,项目名称:canvas-data-tools,代码行数:5,代码来源:UserAgentParser.java

示例7: afterPropertiesSet

import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
    parser = UADetectorServiceFactory.getCachingAndUpdatingParser();
}
 
开发者ID:pulsarIO,项目名称:realtime-analytics,代码行数:5,代码来源:DeviceEnrichmentUtil.java

示例8: UserAgentParser

import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
public UserAgentParser() {
    resourceModuleParser = UADetectorServiceFactory.getResourceModuleParser();
}
 
开发者ID:lukashinsch,项目名称:spring-boot-actuator-user-agent-metrics,代码行数:4,代码来源:UserAgentParser.java

示例9: ReadableUserAgentResolver

import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
/**
 * Create resolver with a default parser.
 */
public ReadableUserAgentResolver() {
	this.parser = UADetectorServiceFactory.getResourceModuleParser();
}
 
开发者ID:mjeanroy,项目名称:springmvc-uadetector,代码行数:7,代码来源:ReadableUserAgentResolver.java

示例10: BrowserResolver

import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
/** Create resolver with a default parser. */
public BrowserResolver() {
	this.parser = UADetectorServiceFactory.getResourceModuleParser();
}
 
开发者ID:mjeanroy,项目名称:springmvc-uadetector,代码行数:5,代码来源:BrowserResolver.java

示例11: userAgentStringParser

import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
@Bean(destroyMethod = "shutdown")
public UserAgentStringParser userAgentStringParser() {
	return UADetectorServiceFactory.getResourceModuleParser();
}
 
开发者ID:mjeanroy,项目名称:springmvc-uadetector,代码行数:5,代码来源:NoCacheParserConfiguration.java

示例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);
}
 
开发者ID:mjeanroy,项目名称:springmvc-uadetector,代码行数:7,代码来源:AbstractCacheConfiguration.java

示例13: AbstractUADetectorCache

import net.sf.uadetector.service.UADetectorServiceFactory; //导入依赖的package包/类
protected AbstractUADetectorCache() {
	this.parser = UADetectorServiceFactory.getResourceModuleParser();
}
 
开发者ID:mjeanroy,项目名称:springmvc-uadetector,代码行数:4,代码来源:AbstractUADetectorCache.java


注:本文中的net.sf.uadetector.service.UADetectorServiceFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。