@Test public void resolveDefaultResolver() throws Exception { filter = new DeviceResolverRequestFilter(); 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"); filter.doFilterInternal(request, response, filterChain); Device device = DeviceUtils.getCurrentDevice(request); assertTrue(device.isMobile()); }
@Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); filterChain.doFilter(request, response); }
DeviceResolverRequestFilter extends OncePerRequestFilter { @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); filterChain.doFilter(request, response); } }
DeviceResolverRequestFilter extends OncePerRequestFilter { @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); filterChain.doFilter(request, response); } DeviceResolverRequestFilter();  DeviceResolverRequestFilter(DeviceResolver deviceResolver); }
DeviceResolverRequestFilter extends OncePerRequestFilter { @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); filterChain.doFilter(request, response); } DeviceResolverRequestFilter();  DeviceResolverRequestFilter(DeviceResolver deviceResolver);  }
DeviceResolverRequestFilter extends OncePerRequestFilter { @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); filterChain.doFilter(request, response); } DeviceResolverRequestFilter();  DeviceResolverRequestFilter(DeviceResolver deviceResolver);   }