May 2015
Intermediate to advanced
234 pages
4h 18m
English
In this recipe, you'll learn how, from a controller method, you can detect whether the current HTTP request has come from a desktop computer, mobile, or tablet.
Register a DeviceResolverHandlerInterceptor interceptor and use DeviceUtils in the controller method:
DeviceResolverHandlerInterceptor bean:@Bean
public DeviceResolverHandlerInterceptor deviceResolverHandlerInterceptor() {
return new DeviceResolverHandlerInterceptor();
}DeviceResolverHandlerInterceptor bean as an interceptor in the addInterceptors() method:@Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(deviceResolverHandlerInterceptor()) ; } ...Read now
Unlock full access