Skip to content

Commit 6367b86

Browse files
committed
GRAILS-10990: IncludeResponseWrapper doesn't override all methods necessary to wrap response
- code from GRAILS-10990, author Craig Andrews
1 parent df9d405 commit 6367b86

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

grails-web/src/main/groovy/org/codehaus/groovy/grails/web/util/IncludeResponseWrapper.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,14 @@ public void setLocale(Locale locale) {
9292

9393
@Override
9494
public void sendError(int i, String s) throws IOException {
95+
if(isCommitted()) throw new IllegalStateException("Response already committed");
9596
setStatus(i);
9697
flushBuffer();
9798
}
9899

99100
@Override
100101
public void sendError(int i) throws IOException {
102+
if(isCommitted()) throw new IllegalStateException("Response already committed");
101103
setStatus(i);
102104
flushBuffer();
103105
}
@@ -159,4 +161,36 @@ public Object getContent(String encoding) throws CharacterCodingException {
159161

160162
return "";
161163
}
164+
165+
@Override
166+
public void resetBuffer() {
167+
if(isCommitted()) throw new IllegalStateException("Response already committed");
168+
if (usingWriter) {
169+
charBuffer.reset();
170+
}
171+
172+
if (usingStream) {
173+
byteBuffer.reset();
174+
}
175+
}
176+
177+
@Override
178+
public void reset() {
179+
resetBuffer();
180+
}
181+
182+
@Override
183+
public void setContentLength(int len) {
184+
// do nothing
185+
}
186+
187+
@Override
188+
public void setStatus(int sc, String sm) {
189+
setStatus(sc);
190+
}
191+
192+
@Override
193+
public void flushBuffer() {
194+
// do nothing
195+
}
162196
}

0 commit comments

Comments
 (0)