@Test public void resolveDefaultResolver() throws Exception { interceptor = new DeviceResolverHandlerInterceptor(); request.addHeader("User-Agent", "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7"); assertTrue(interceptor.preHandle(request, response, null)); Device device = DeviceUtils.getCurrentDevice(request); assertTrue(device.isMobile()); }
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); return true; }
DeviceResolverHandlerInterceptor extends HandlerInterceptorAdapter { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); return true; } }
DeviceResolverHandlerInterceptor extends HandlerInterceptorAdapter { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); return true; } DeviceResolverHandlerInterceptor();  DeviceResolverHandlerInterceptor(DeviceResolver deviceResolver); }
DeviceResolverHandlerInterceptor extends HandlerInterceptorAdapter { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); return true; } DeviceResolverHandlerInterceptor();  DeviceResolverHandlerInterceptor(DeviceResolver deviceResolver); boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler); }
DeviceResolverHandlerInterceptor extends HandlerInterceptorAdapter { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); return true; } DeviceResolverHandlerInterceptor();  DeviceResolverHandlerInterceptor(DeviceResolver deviceResolver); boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler);  }