-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Description
cemo koc opened SPR-12815 and commented
I have an issue with reading inputstream from request multiple times. Before trying an implementation, I have searched in Spring and came across ContentCachingRequestWrapper. This is a nice utility but requires you to have an instance of ContentCachingRequestWrapper to use it as this:
ContentCachingRequestWrapper wrapper = (ContentCachingRequestWrapper) request;
byte[] buf = wrapper.getContentAsByteArray();
This is pretty much limiting because servlet filters are usually wrapping requests into another request instance to provide additional capabilities. I can access this content if only I have an instance of this filter.
It would be great If this behaviour can be changed to provide a new inputstream with cached data.
I have questioned myself why It was not implemented like this in the first place but really could not find a reason.
Shortly, please improve getInputStream and getReader methods to provide cached content in case a consumed stream. Thus we do not need to consider whether request is an instance of ContentCachingRequestWrapper or not.
Affects: 4.1.5
Issue Links:
- Not reusable input stream in ContentCachingRequestWrapper [SPR-12810] #17407 Not reusable input stream in ContentCachingRequestWrapper
1 votes, 5 watchers