May 2015
Intermediate to advanced
234 pages
4h 18m
English
In this recipe, you'll learn how, with interceptors, we can execute some code across all controllers at different moments of a request workflow with the preHandle(), postHandle(), and afterCompletion() hooks:

Interceptors are used for authentication, logging, and profiling (among others).
Here are the steps to create and register an interceptor:
HandlerInterceptorAdapter:public class PerformanceInterceptor extends HandlerInterceptorAdapter {@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse ...Read now
Unlock full access