Package net.sf.uadetector

Examples of net.sf.uadetector.UserAgent


    assertThat(category.getInfoUrl()).isEqualTo("/list-of-ua/device-detail?device=Other");
  }

  @Test
  public void parse_unknownString() {
    final UserAgent agent = PARSER.parse("qwertzuiopasdfghjklyxcvbnm");

    // check user agent informations
    final UserAgent e = UserAgent.EMPTY;
    assertThat(agent.getFamily()).isEqualTo(e.getFamily());
    assertThat(agent.getName()).isEqualTo(e.getName());
    assertThat(agent.getProducer()).isEqualTo(e.getProducer());
    assertThat(agent.getProducerUrl()).isEqualTo(e.getProducerUrl());
    assertThat(agent.getTypeName()).isEqualTo(e.getTypeName());
    assertThat(agent.getUrl()).isEqualTo(e.getUrl());
    assertThat(agent.getVersionNumber()).isEqualTo(VersionNumber.UNKNOWN);

    // check operating system informations
    assertThat(agent.getOperatingSystem()).isEqualTo(OperatingSystem.EMPTY);
View Full Code Here


    public boolean preHandle(javax.servlet.http.HttpServletRequest request,
            HttpServletResponse response, Object handler) throws Exception {
        final String mobil = "detectedDevice";
        final Device device = deviceResolver.resolveDevice(request);
        final UserAgentStringParser parser = UADetectorServiceFactory.getResourceModuleParser();
        final UserAgent agent = parser.parse(request.getHeader("User-Agent"));
        log.trace("user agent --->" + agent.toString());
        request.setAttribute("so", agent.getOperatingSystem().getFamily());
        request.setAttribute("bo_vendor", agent.getProducer());
        request.setAttribute("agent_type", agent.getTypeName());
        request.setAttribute("agent_name", agent.getName());
        request.setAttribute("agent_family", agent.getFamily());
        request.setAttribute("agent_pro_url", agent.getProducerUrl());
        request.setAttribute("bo_vendor_ver", agent.getVersionNumber().getMajor());
        final Boolean enabledMobileDevice = EnMePlaceHolderConfigurer
                .getBooleanProperty("application.mobile.enabled");
        final Boolean forceMobileDevice = EnMePlaceHolderConfigurer
                .getBooleanProperty("application.mobile.only");
        log.trace(" enabledMobileDevice => "+enabledMobileDevice);
View Full Code Here

TOP

Related Classes of net.sf.uadetector.UserAgent

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.