PostClient { public void gzip() throws IOException { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost post = new HttpPost("http: post.addHeader("Referer", "http: post.addHeader("Host", "ce.cloud.360.cn"); post.addHeader("Origin", "http: post.addHeader("X-Requested-With", "XMLHttpRequest"); post.addHeader("Content-Type", "application/x-www-form-urlencoded"); post.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); post.addHeader("Accept-Encoding", "gzip, deflate"); post.addHeader("Accept-Language", "zh-cn,en-us;q=0.7,en;q=0.3"); post.addHeader("Pragma", "no-cache"); post.addHeader("Cache-Control", "no-cache"); List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>(); params.add(new BasicNameValuePair("type", "get")); params.add(new BasicNameValuePair("domain", "http: params.add(new BasicNameValuePair("_token__", "15a2028adadc8fa72c59a1098ed24e7b_f98a473a07c18b1b6aaf2670bbf66bb1")); UrlEncodedFormEntity formEntity = null; HttpResponse response = null; String responseHtml = null; HttpEntity entity = null; try { formEntity = new UrlEncodedFormEntity(params, "utf-8"); post.setEntity(formEntity); response = httpClient.execute(post); entity = response.getEntity(); InputStream is = entity.getContent(); is = new GZIPInputStream(is); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line = null; StringBuffer sb = new StringBuffer(); while ((line = br.readLine()) != null) { sb.append(line); } responseHtml = sb.toString(); log.info(responseHtml); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (response != null) { EntityUtils.consume(entity); } } }  void post(); void post2(); void gzip();  }
@Test public void testGzip() throws Exception { postClient.gzip(); }