I wrote interceptor:
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
log.info("[pre-handle] method: {}\tURL: {}", request.getMethod(), request.getRequestURL());
if (HttpMethod.POST.name().equals(request.getMethod())) {
log.info(request.getReader().lines().collect(Collectors.joining()));
}
return true;
}
but when I try to call controller, exception throws:
java.lang.IllegalStateException: Cannot call getInputStream() after getReader() has already been called for the current request
as I understand, getReader() calling closes InputStream & nothing comes to controller. How to fix it?