public class DeviceUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.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(javax.servlet.http.HttpServletRequest request)
Static utility method that extracts the current device from the web request.
|
static Device |
getCurrentDevice(org.springframework.web.context.request.RequestAttributes attributes)
Static utility method that extracts the current device from the request attributes map.
|
static Device |
getRequiredCurrentDevice(javax.servlet.http.HttpServletRequest request)
Static utility method that extracts the current device from the web request.
|
public static final java.lang.String CURRENT_DEVICE_ATTRIBUTE
public static Device getCurrentDevice(javax.servlet.http.HttpServletRequest request)
ServletRequest.getAttribute(String)
lookup.request
- the servlet requestpublic static Device getRequiredCurrentDevice(javax.servlet.http.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(org.springframework.web.context.request.RequestAttributes attributes)
ServletRequest.getAttribute(String)
lookup.attributes
- the request attributes