Skip to content

Commit

Permalink
Enforce ConditionalContentCachingResponseWrapper in ShallowEtagHeader…
Browse files Browse the repository at this point in the history
…Filter

Closes gh-24976
  • Loading branch information
jhoeller committed Jul 19, 2020
1 parent 165a6f1 commit 9a618dc
Showing 1 changed file with 3 additions and 6 deletions.
Expand Up @@ -99,7 +99,7 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
throws ServletException, IOException {

HttpServletResponse responseToUse = response;
if (!isAsyncDispatch(request) && !(response instanceof ContentCachingResponseWrapper)) {
if (!isAsyncDispatch(request) && !(response instanceof ConditionalContentCachingResponseWrapper)) {
responseToUse = new ConditionalContentCachingResponseWrapper(response, request);
}

Expand All @@ -111,10 +111,8 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
}

private void updateResponse(HttpServletRequest request, HttpServletResponse response) throws IOException {

ContentCachingResponseWrapper wrapper =
WebUtils.getNativeResponse(response, ContentCachingResponseWrapper.class);

ConditionalContentCachingResponseWrapper wrapper =
WebUtils.getNativeResponse(response, ConditionalContentCachingResponseWrapper.class);
Assert.notNull(wrapper, "ContentCachingResponseWrapper not found");
HttpServletResponse rawResponse = (HttpServletResponse) wrapper.getResponse();

Expand Down Expand Up @@ -219,7 +217,6 @@ private static class ConditionalContentCachingResponseWrapper extends ContentCac

private final HttpServletRequest request;


ConditionalContentCachingResponseWrapper(HttpServletResponse response, HttpServletRequest request) {
super(response);
this.request = request;
Expand Down

0 comments on commit 9a618dc

Please sign in to comment.