1
Hello, I’m using an Interceptor that will intercept before and after the request. The goal of this is to get the size of the content sent and returned, however, I do not know a way to get the answer, it seems that the sponse has no method to catch 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);
}
}
Good afternoon. Face value came null for both (content-length and content-encoding). What was there ?
– Jonathan