I want to intercept Spring servlet response just at the end of the request. I mean, what i want to do is to log service response, that json which services returns and the statusCode. That is all what i want to log.
For that, i've already tried using HandlerInterceptorAdapter like this
public class ResponseLoggerInterceptor
extends HandlerInterceptorAdapter {
private static final Logger LOGGER = LoggerFactory.getLogger(ResponseLoggerInterceptor.class);
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
LOGGER.info("Intercepted");
super.postHandle(request, response, handler, modelAndView);
}
}
That "handler" object is the object respose, but it is not serialized. Do you know where and how i have to intercept the very last servlet response? Thanks in advance