Don't get ContentCachingResponseWrapper in ShallowEtagHeaderFilter so that users can extend this wrapper #24976
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Issue Description:
Code in
ShallowEtagHeaderFilter
:WebUtils.getNativeResponse(response, ContentCachingResponseWrapper.class);
should be replaced into
WebUtils.getNativeResponse(response, ConditionalContentCachingResponseWrapper.class);
so that users can implement their own business logic based onContentCachingResponseWrapper
.Change
ContentCachingResponseWrapper
toConditionalContentCachingResponseWrapper
so that it gets the right one.I have implemented my own Filter, and in my own Filter, i have implemented my own ResponseWrapper which extends
ContentCachingResponseWrapper
, everything works fine ifShallowEtagHeaderFilter
is not loaded, but when it works withShallowEtagHeaderFilter
, whenShallowEtagHeaderFilter.updateResponse
is invoked, the real HttpServletResponse get throughWebUtils.getNativeResponse(response, ContentCachingResponseWrapper.class);
become my own ResponseWrapper, so my own logic will be invoked insideShallowEtagHeaderFilter
, which is a mistake.By changing the code to
WebUtils.getNativeResponse(response, ConditionalContentCachingResponseWrapper.class);
, everything will be fine.Affects: <5.2.5.RELEASE and others>
The text was updated successfully, but these errors were encountered: