There is a special feature in Grails Sitemesh integration. If the response gets committed, the layout won't be applied.
While debugging a sample application provided by Luke Daley (related to GRAILSPLUGINS-2729 problem), I noticed that the layout didn't get applied in GrailsPageFilter because the response was committed.
I noticed that response got committed in GSPResponseWriter.close() (which calls flush(), which committed the response). (GSPResponseWriter.close() gets called
This change is just an improvement that prevents the response getting committed too early. It blocks flush() and close() while Sitemesh is active and the view is being rendered. Blocking is removed if Sitemesh gets "aborted" by setting a content type that shouldn't be decorated by Sitemesh.