- changed status to resolved
[spring-mvc] use ContentCachingRequestWrapper if request is already wrapped in it
Issue #304
resolved
If the current request is already wrapped in the org.springframework.web.util.ContentCachingRequestWrapper
use that instead of the custom ResettableRequestServletWrapper
.
If the request is still unwrapped the ResettableRequestServletWrapper
shall be preferred.
Same goes for the response wrapping.
Comments (1)
-
reporter - Log in to comment
After exploring the ContentCachingRequestWrapper I found out that it will not work.
The ContentCachingRequestWrapper is not able to reset a requests body to re-read it from Spring. Only after Spring has processed the request the body is available. But this is too late for request validation.
Furthermore the ContentCachingRequestWrapper can be limited in its cached body length - e.g. 1024 bytes. If that's the case not the whole body would be cached.