public class DeviceUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CURRENT_DEVICE_ATTRIBUTE
The name of the request attribute the current Device is indexed by.
|
Constructor and Description |
---|
DeviceUtils() |
Modifier and Type | Method and Description |
---|---|
static Device |
getCurrentDevice(HttpServletRequest request)
Static utility method that extracts the current device from the web request.
|
static Device |
getCurrentDevice(RequestAttributes attributes)
Static utility method that extracts the current device from the request attributes map.
|
static Device |
getRequiredCurrentDevice(HttpServletRequest request)
Static utility method that extracts the current device from the web request.
|
public static final String CURRENT_DEVICE_ATTRIBUTE
public static Device getCurrentDevice(HttpServletRequest request)
ServletRequest.getAttribute(String)
lookup.request
- the servlet requestpublic static Device getRequiredCurrentDevice(HttpServletRequest request)
ServletRequest.getAttribute(String)
lookup.
Throws a runtime exception if the current device has not been resolved.request
- the servlet requestpublic static Device getCurrentDevice(RequestAttributes attributes)
ServletRequest.getAttribute(String)
lookup.attributes
- the request attributes