public Device detectDevice(HttpServletRequest request) {
    WURFLManager wurflManager = _wurflHolderImpl.getWURFLManager();

    if (wurflManager == null) {
      if (_log.isWarnEnabled()) {
        _log.warn("WURFL database has not initialized");
      }

      return UnknownDevice.getInstance();
    }

    net.sourceforge.wurfl.core.Device wurflDevice = wurflManager.getDeviceForRequest(request);

    Device device = null;

    if (wurflDevice != null) {
      Map<String, String> capabilities = wurflDevice.getCapabilities();

      if ((capabilities != null) && !capabilities.isEmpty()) {
        device = new WURFLDevice(capabilities, _deviceCapabilityFilter);
      } else {
        device = UnknownDevice.getInstance();
      }
    }

    return device;
  }
Beispiel #2
0
  protected Device getDevice(ThemeDisplay themeDisplay) {
    if (themeDisplay != null) {
      return themeDisplay.getDevice();
    }

    return UnknownDevice.getInstance();
  }