org.springframework.mobile.device.lite
Class LiteDeviceResolver

java.lang.Object
  extended by org.springframework.mobile.device.lite.LiteDeviceResolver
All Implemented Interfaces:
DeviceResolver

public class LiteDeviceResolver
extends java.lang.Object
implements DeviceResolver

A "lightweight" device resolver algorithm based on Wordpress's Mobile pack. Detects the presence of a mobile device and works for a large percentage of mobile browsers. Does not perform any device capability mapping, if you need that consider WurflDeviceResolver. The code is based primarily on a list of approximately 90 well-known mobile browser UA string snippets, with a couple of special cases for Opera Mini, the W3C default delivery context and certain other Windows browsers. The code also looks to see if the browser advertises WAP capabilities as a hint.


Constructor Summary
LiteDeviceResolver()
           
 
Method Summary
protected  java.util.List<java.lang.String> getUserAgentKeywords()
          List of user agent keywords that identify mobile devices.
protected  java.util.List<java.lang.String> getUserAgentPrefixes()
          List of user agent prefixes that identify mobile devices.
protected  void init()
          Initialize this device resolver implementation.
 Device resolveDevice(javax.servlet.http.HttpServletRequest request)
          Resolve the device that originated the web request.
protected  Device resolveFallback(javax.servlet.http.HttpServletRequest request)
          Fallback called if no mobile device is matched by this resolver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LiteDeviceResolver

public LiteDeviceResolver()
Method Detail

resolveDevice

public Device resolveDevice(javax.servlet.http.HttpServletRequest request)
Description copied from interface: DeviceResolver
Resolve the device that originated the web request.

Specified by:
resolveDevice in interface DeviceResolver

getUserAgentPrefixes

protected java.util.List<java.lang.String> getUserAgentPrefixes()
List of user agent prefixes that identify mobile devices. Used primarily to match by operator or handset manufacturer.


getUserAgentKeywords

protected java.util.List<java.lang.String> getUserAgentKeywords()
List of user agent keywords that identify mobile devices. Used primarily to match by mobile platform or operating system.


init

protected void init()
Initialize this device resolver implementation. Registers the known set of device signature strings. Subclasses may override to register additional strings.


resolveFallback

protected Device resolveFallback(javax.servlet.http.HttpServletRequest request)
Fallback called if no mobile device is matched by this resolver. The default implementation of this method returns a "not mobile" Device with the mobile property set to false. Subclasses may override to try additional mobile device matching before falling back to a "not mobile" device.