2013-09-26 22:26:45 +08:00
|
|
|
package org.test
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
@EnableDeviceResolver
|
|
|
|
class Example {
|
|
|
|
|
|
|
|
@RequestMapping("/")
|
|
|
|
@ResponseBody
|
2013-10-09 22:16:01 +08:00
|
|
|
String helloWorld(Device device) {
|
2013-09-26 22:26:45 +08:00
|
|
|
if (device.isNormal()) {
|
2013-10-09 22:16:01 +08:00
|
|
|
"Hello Normal Device!"
|
2013-09-26 22:26:45 +08:00
|
|
|
} else if (device.isMobile()) {
|
2013-10-09 22:16:01 +08:00
|
|
|
"Hello Mobile Device!"
|
2013-09-26 22:26:45 +08:00
|
|
|
} else if (device.isTablet()) {
|
2013-10-09 22:16:01 +08:00
|
|
|
"Hello Tablet Device!"
|
2013-09-26 22:26:45 +08:00
|
|
|
} else {
|
2013-10-09 22:16:01 +08:00
|
|
|
"Hello Unknown Device!"
|
2013-09-26 22:26:45 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|