可以通过Gzip对返回的数据进行压缩以减少返回数据的大小。
1、对数据压缩,并且设置response Header
ByteArrayOutputStream out = new ByteArrayOutputStream();
GZIPOutputStream gout = new GZIPOutputStream(out);
gout.write(jsonObjectPar.toString().getBytes("UTF-8"));
gout.close();
result = out.toByteArray();
response.setHeader("Content-Encoding","gzip");
http://www.cnblogs.com/bcsflilong/p/4245336.html
2、接收端也需要进行相应处理
检测是否是通过gzip 压缩的,然后解压缩
responseString = EntityUtils.toString(new GzipDecompressingEntity(rep.getEntity()));
http://www.bubuko.com/infodetail-900261.html