From 06c250fe5e5cf9a6a8353cb4d8826690789c8858 Mon Sep 17 00:00:00 2001 From: Scott Murphy Heiberg Date: Tue, 1 Oct 2024 13:24:43 -0700 Subject: [PATCH] Fix for sitemesh. Buffering is triggered on response.setContentType so rendering needs to be done on wrapped response. --- .../groovy/org/grails/web/servlet/view/AbstractGrailsView.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/grails-web-common/src/main/groovy/org/grails/web/servlet/view/AbstractGrailsView.java b/grails-web-common/src/main/groovy/org/grails/web/servlet/view/AbstractGrailsView.java index b7ee436ad58..99602b1bd3c 100644 --- a/grails-web-common/src/main/groovy/org/grails/web/servlet/view/AbstractGrailsView.java +++ b/grails-web-common/src/main/groovy/org/grails/web/servlet/view/AbstractGrailsView.java @@ -24,6 +24,7 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import org.grails.web.servlet.WrappedResponseHolder; import org.grails.web.util.GrailsApplicationAttributes; import org.grails.web.servlet.mvc.GrailsWebRequest; import org.grails.web.util.WebUtils; @@ -68,6 +69,8 @@ private void renderWithinGrailsWebRequest(Map model, HttpServlet } else { webRequest = (GrailsWebRequest)requestAttributes; } + // Update response holder to latest response. Necessary for sitemesh to trigger buffering. + WrappedResponseHolder.setWrappedResponse(response); renderTemplate(model, webRequest, request, response); } finally { if(attributesChanged) {