|
|
@ -101,8 +101,11 @@ class SmartOutputStream extends TemporaryBuffer { |
|
|
|
TemporaryBuffer gzbuf = new TemporaryBuffer.Heap(LIMIT); |
|
|
|
TemporaryBuffer gzbuf = new TemporaryBuffer.Heap(LIMIT); |
|
|
|
try { |
|
|
|
try { |
|
|
|
GZIPOutputStream gzip = new GZIPOutputStream(gzbuf); |
|
|
|
GZIPOutputStream gzip = new GZIPOutputStream(gzbuf); |
|
|
|
out.writeTo(gzip, null); |
|
|
|
try { |
|
|
|
gzip.close(); |
|
|
|
out.writeTo(gzip, null); |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
gzip.close(); |
|
|
|
|
|
|
|
} |
|
|
|
if (gzbuf.length() < out.length()) { |
|
|
|
if (gzbuf.length() < out.length()) { |
|
|
|
out = gzbuf; |
|
|
|
out = gzbuf; |
|
|
|
rsp.setHeader(HDR_CONTENT_ENCODING, ENCODING_GZIP); |
|
|
|
rsp.setHeader(HDR_CONTENT_ENCODING, ENCODING_GZIP); |
|
|
|