JSONUtil.writeJSONToResponse(SerializationParams serializationParams)
上面第4行改为如下代码:
...
try {
out = new GZIPOutputStream(response.getOutputStream());
in = new ByteArrayInputStream(json.getBytes());
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
} finally {
if (in != null)
in.close();
if (out != null) {
out.finish();
out.close();
}
}
...
上面第4行改为如下代码:
in = new ByteArrayInputStream(json.getBytes(serializationParams.getEncoding()));