Hello, I'm using an interceptor that will intercept before and after the request. The purpose of this is to get the size of the content sent and returned, however, I do not know how to get the answer, it seems that the response does not have a method to get it
@Component
public class DataUsageInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(
HttpServletRequest request,
HttpServletResponse response,
Object handler
) throws Exception {
System.out.println("Tamanho da requisicao: " + request.getContentLength());
return super.preHandle(request, response, handler);
}
@Override
public void afterCompletion(
HttpServletRequest request,
HttpServletResponse response,
Object handler, Exception ex
) throws Exception {
System.out.println("Tamanho da resposta: ??");
super.afterCompletion(request, response, handler, ex);
}
}