Chapter 6, Internalize Your Store with Interceptor

Questions

Answers

Consider the following interceptor:

public class SecurityInterceptor extends   HandlerInterceptorAdapter{    
    
   @Override    
   public void afterCompletion(HttpServletRequest   request,   HttpServletResponse response, Object handler, Exception ex)     throws Exception {    
         // just some code related to after completion    
   }    
}    

Is this SecurityInterceptor class a valid interceptor?

2. It is valid because it extends the HandlerInterceptorAdapter class.

Within the interceptor methods, what is the order of execution?

2. preHandle, postHandle, afterCompletion.

Get Spring: Developing Java Applications for the Enterprise now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.