Logic I have to implement is logging all requests with body served to DB.
So I decided to use: afterCompletion
method of HandlerInterceptor
Here's the relevant statement from javadoc for HandlerInterceptor javadoc.
Callback after completion of request processing, that is, after rendering the view. Will be called on any outcome of handler execution, thus allows for proper resource cleanup.
HandlerIntercepter Javadoc
You cannot access the request body (as an InputStream) because the request was already read. If you need access to request parameters, you could do so using the request object by calling - request.getParameter("parameterName");
You cannot access the response body because the response is already rendered. That means the response is already committed to the outputstream.