Package ua_parser

Examples of ua_parser.Client


      return null;
    }
    if (cacheClient == null) {
      cacheClient = new LRUMap(CACHE_SIZE);
    }
    Client client = cacheClient.get(agentString);
    if (client != null) {
      return client;
    }
    client = super.parse(agentString);
    cacheClient.put(agentString, client);
View Full Code Here


public class UserAgentMorphlineTest extends AbstractMorphlineTest {

  @Test
  public void testRawAPI() throws Exception {
    String userAgentStr = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3";
    Client client = new Parser().parse(userAgentStr);

    assertEquals("Mobile Safari", client.userAgent.family);
    assertEquals("5", client.userAgent.major);
    assertEquals("1", client.userAgent.minor);
    assertNull(client.userAgent.patch);
View Full Code Here

 

  @Test
  public void testRawAPIWithUnknownUserAgent() throws Exception {
    String userAgentStr = "fp@$%3489jvp#3E";
    Client client = new Parser().parse(userAgentStr);
   
    assertNotNull(client);
    assertEquals("Other", client.userAgent.family);
    assertNull(client.userAgent.major);
    assertNull(client.userAgent.minor);
View Full Code Here

public class UserAgentMorphlineTest extends AbstractMorphlineTest {

  @Test
  public void testRawAPI() throws Exception {
    String userAgentStr = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3";
    Client client = new Parser().parse(userAgentStr);

    assertEquals("Mobile Safari", client.userAgent.family);
    assertEquals("5", client.userAgent.major);
    assertEquals("1", client.userAgent.minor);
    assertNull(client.userAgent.patch);
View Full Code Here

 

  @Test
  public void testRawAPIWithUnknownUserAgent() throws Exception {
    String userAgentStr = "fp@$%3489jvp#3E";
    Client client = new Parser().parse(userAgentStr);
   
    assertNotNull(client);
    assertEquals("Other", client.userAgent.family);
    assertNull(client.userAgent.major);
    assertNull(client.userAgent.minor);
View Full Code Here

      }
      record.put(fieldName, result);
    }

    private String extract(String userAgent) {
      Client client = parser.parse(userAgent);       
      StringBuilder buf = new StringBuilder();
      String lastString = null;
     
      for (Object component : components)  {
        assert component != null;
View Full Code Here

      }
      record.put(fieldName, result);
    }

    private String extract(String userAgent) {
      Client client = parser.parse(userAgent);       
      StringBuilder buf = new StringBuilder();
      String lastString = null;
     
      for (Object component : components)  {
        assert component != null;
View Full Code Here

    if (UserAgent == null ) {
      return null;
    }

    try {
    Client c = uaParser.parse(UserAgent.toString());

    if (options == null) {
      result.set(c.toString());
    }

    else {
      userOptions uo = userOptions.valueOf(options.toString().toLowerCase());
     
View Full Code Here

TOP

Related Classes of ua_parser.Client

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.