LogInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { logAccess("<-", request, response); if (LOG.isDebugEnabled()) { LOG.debug("Headers:"); Enumeration<String> headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String name = headerNames.nextElement(); LOG.debug("\t{}=\"{}\"", name, request.getHeader(name)); } } return true; }  @Override boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler); @Override void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex);  }
@Test public void testPreHandle() { interceptor.preHandle(request, response, "testPreHandle"); }
@Test public void testError() { response.setStatus(404); request.setRequestURI("/error"); request.setAttribute("javax.servlet.error.request_uri", "/gibts/net"); interceptor.preHandle(request, response, "testError"); }